MFamd64 (1.275):

Reduce the scope of the Giant lock being held for non-mpsafe syscalls.
There was way too much code being covered.
This commit is contained in:
Marcel Moolenaar 2004-07-08 21:08:07 +00:00
parent 6d10efc0af
commit 1e3e78d239

View File

@ -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