From 1e3e78d23986d70575fb080f920c8bf5e0fd90f7 Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Thu, 8 Jul 2004 21:08:07 +0000 Subject: [PATCH] MFamd64 (1.275): Reduce the scope of the Giant lock being held for non-mpsafe syscalls. There was way too much code being covered. --- sys/ia64/ia64/trap.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/sys/ia64/ia64/trap.c b/sys/ia64/ia64/trap.c index 5b0049417ac3..0145ed2b0a6c 100644 --- a/sys/ia64/ia64/trap.c +++ b/sys/ia64/ia64/trap.c @@ -973,11 +973,6 @@ syscall(struct trapframe *tf) else callp = &p->p_sysent->sv_table[code]; - /* - * Try to run the syscall without Giant if the syscall is MP safe. - */ - if ((callp->sy_narg & SYF_MPSAFE) == 0) - mtx_lock(&Giant); #ifdef KTRACE if (KTRPOINT(td, KTR_SYSCALL)) ktrsyscall(code, (callp->sy_narg & SYF_ARGMASK), args); @@ -991,7 +986,15 @@ syscall(struct trapframe *tf) PTRACESTOP_SC(p, td, S_PT_SCE); - error = (*callp->sy_call)(td, args); + /* + * Grab Giant if the syscall is not flagged as MP safe. + */ + if ((callp->sy_narg & SYF_MPSAFE) == 0) { + mtx_lock(&Giant); + error = (*callp->sy_call)(td, args); + mtx_unlock(&Giant); + } else + error = (*callp->sy_call)(td, args); if (error != EJUSTRETURN) { /* @@ -1013,12 +1016,6 @@ syscall(struct trapframe *tf) } } - /* - * Release Giant if we had to get it. - */ - if ((callp->sy_narg & SYF_MPSAFE) == 0) - mtx_unlock(&Giant); - userret(td, tf, sticks); #ifdef KTRACE