summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_thread.c
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2008-03-21 08:23:25 +0000
committerjeff <jeff@FreeBSD.org>2008-03-21 08:23:25 +0000
commitba540b27d633327453067e692e5ccb2095d417c1 (patch)
tree85009349e539f1265173b5d33889d0fca5031c61 /sys/kern/kern_thread.c
parent8420f5505a178be36939d61d6e9da31e0f2eb05a (diff)
downloadFreeBSD-src-ba540b27d633327453067e692e5ccb2095d417c1.zip
FreeBSD-src-ba540b27d633327453067e692e5ccb2095d417c1.tar.gz
- Add a new td flag TDF_NEEDSUSPCHK that is set whenever a thread needs
to enter thread_suspend_check(). - Set TDF_ASTPENDING along with TDF_NEEDSUSPCHK so we can move the thread_suspend_check() to ast() rather than userret(). - Check TDF_NEEDSUSPCHK in the sleepq_catch_signals() optimization so that we don't miss a suspend request. If this is set use the expensive signal path. - Set NEEDSUSPCHK when creating a new thread in thr in case the creating thread is due to be suspended as well but has not yet. Reviewed by: davidxu (Authored original patch)
Diffstat (limited to 'sys/kern/kern_thread.c')
-rw-r--r--sys/kern/kern_thread.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index 65fdae4..8745e5e 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -549,7 +549,7 @@ thread_single(int mode)
if (td2 == td)
continue;
thread_lock(td2);
- td2->td_flags |= TDF_ASTPENDING;
+ td2->td_flags |= TDF_ASTPENDING | TDF_NEEDSUSPCHK;
if (TD_IS_INHIBITED(td2)) {
switch (mode) {
case SINGLE_EXIT:
@@ -751,6 +751,7 @@ thread_suspend_switch(struct thread *td)
p->p_suspcount++;
PROC_UNLOCK(p);
thread_lock(td);
+ td->td_flags &= ~TDF_NEEDSUSPCHK;
TD_SET_SUSPENDED(td);
sched_sleep(td, 0);
PROC_SUNLOCK(p);
@@ -771,6 +772,7 @@ thread_suspend_one(struct thread *td)
THREAD_LOCK_ASSERT(td, MA_OWNED);
KASSERT(!TD_IS_SUSPENDED(td), ("already suspended"));
p->p_suspcount++;
+ td->td_flags &= ~TDF_NEEDSUSPCHK;
TD_SET_SUSPENDED(td);
sched_sleep(td, 0);
}
OpenPOWER on IntegriCloud