summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2001-03-07 03:53:39 +0000
committerjhb <jhb@FreeBSD.org>2001-03-07 03:53:39 +0000
commit9c1fb038d7d49d0f13914c9cf74abbaf2252f87c (patch)
treeea5c5756813dfc5f6d0f22d45ad1cfb40be1cc74 /sys/kern
parentf75a181b19d1c3a7bc52017f779a09ea9c8cecb0 (diff)
downloadFreeBSD-src-9c1fb038d7d49d0f13914c9cf74abbaf2252f87c.zip
FreeBSD-src-9c1fb038d7d49d0f13914c9cf74abbaf2252f87c.tar.gz
- Release Giant a bit earlier on syscall exit.
- Don't try to grab Giant before postsig() in userret() as it is no longer needed. - Don't grab Giant before psignal() in ast() but get the proc lock instead.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/subr_trap.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c
index bb03fa6..7088d0c 100644
--- a/sys/kern/subr_trap.c
+++ b/sys/kern/subr_trap.c
@@ -172,11 +172,8 @@ userret(p, frame, oticks)
{
int sig;
- while ((sig = CURSIG(p)) != 0) {
- if (!mtx_owned(&Giant))
- mtx_lock(&Giant);
+ while ((sig = CURSIG(p)) != 0)
postsig(sig);
- }
mtx_lock_spin(&sched_lock);
p->p_pri.pri_level = p->p_pri.pri_user;
@@ -195,11 +192,8 @@ userret(p, frame, oticks)
mi_switch();
mtx_unlock_spin(&sched_lock);
PICKUP_GIANT();
- while ((sig = CURSIG(p)) != 0) {
- if (!mtx_owned(&Giant))
- mtx_lock(&Giant);
+ while ((sig = CURSIG(p)) != 0)
postsig(sig);
- }
mtx_lock_spin(&sched_lock);
}
@@ -508,9 +502,9 @@ restart:
*/
if (frame.tf_eip == (int)cpu_switch_load_gs) {
PCPU_GET(curpcb)->pcb_gs = 0;
- mtx_lock(&Giant);
+ PROC_LOCK(p);
psignal(p, SIGBUS);
- mtx_unlock(&Giant);
+ PROC_UNLOCK(p);
goto out;
}
@@ -1247,18 +1241,18 @@ bad:
#endif
/*
+ * Release Giant if we had to get it
+ */
+ if (mtx_owned(&Giant))
+ mtx_unlock(&Giant);
+
+ /*
* This works because errno is findable through the
* register set. If we ever support an emulation where this
* is not the case, this code will need to be revisited.
*/
STOPEVENT(p, S_SCX, code);
- /*
- * Release Giant if we had to get it
- */
- if (mtx_owned(&Giant))
- mtx_unlock(&Giant);
-
#ifdef WITNESS
if (witness_list(p)) {
panic("system call %s returning with mutex(s) held\n",
@@ -1305,17 +1299,17 @@ ast(framep)
if (p->p_sflag & PS_ALRMPEND) {
p->p_sflag &= ~PS_ALRMPEND;
mtx_unlock_spin(&sched_lock);
- if (!mtx_owned(&Giant))
- mtx_lock(&Giant);
+ PROC_LOCK(p);
psignal(p, SIGVTALRM);
+ PROC_UNLOCK(p);
mtx_lock_spin(&sched_lock);
}
if (p->p_sflag & PS_PROFPEND) {
p->p_sflag &= ~PS_PROFPEND;
mtx_unlock_spin(&sched_lock);
- if (!mtx_owned(&Giant))
- mtx_lock(&Giant);
+ PROC_LOCK(p);
psignal(p, SIGPROF);
+ PROC_UNLOCK(p);
} else
mtx_unlock_spin(&sched_lock);
OpenPOWER on IntegriCloud