summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_thread.c
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2007-09-21 04:04:22 +0000
committerjeff <jeff@FreeBSD.org>2007-09-21 04:04:22 +0000
commit13d3160ef56965cf078529f5abb63d74e18d015a (patch)
tree6d98cd30b5e7e7ba84da4323e5bae804102b875b /sys/kern/kern_thread.c
parentbe5effe1578253fec824b4ca40856aa85c5bd32d (diff)
downloadFreeBSD-src-13d3160ef56965cf078529f5abb63d74e18d015a.zip
FreeBSD-src-13d3160ef56965cf078529f5abb63d74e18d015a.tar.gz
- Call sched_sleep() before we suspend threads. sched_wakeup() is already
called via setrunnable(). This allows time slept while suspended to be accounted for swap. Approved by: re
Diffstat (limited to 'sys/kern/kern_thread.c')
-rw-r--r--sys/kern/kern_thread.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index b003257..97c56a4 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -852,6 +852,7 @@ thread_suspend_switch(struct thread *td)
p->p_suspcount++;
PROC_UNLOCK(p);
thread_lock(td);
+ sched_sleep(td);
TD_SET_SUSPENDED(td);
PROC_SUNLOCK(p);
DROP_GIANT();
@@ -871,6 +872,7 @@ thread_suspend_one(struct thread *td)
THREAD_LOCK_ASSERT(td, MA_OWNED);
KASSERT(!TD_IS_SUSPENDED(td), ("already suspended"));
p->p_suspcount++;
+ sched_sleep(td);
TD_SET_SUSPENDED(td);
}
OpenPOWER on IntegriCloud