svn commit: r239585 - head/sys/kern
John Baldwin
jhb at FreeBSD.org
Wed Aug 22 20:01:39 UTC 2012
Author: jhb
Date: Wed Aug 22 20:01:38 2012
New Revision: 239585
URL: http://svn.freebsd.org/changeset/base/239585
Log:
Mark the idle threads as non-sleepable and also assert that an idle
thread never blocks on a turnstile.
Modified:
head/sys/kern/sched_4bsd.c
head/sys/kern/sched_ule.c
head/sys/kern/subr_turnstile.c
Modified: head/sys/kern/sched_4bsd.c
==============================================================================
--- head/sys/kern/sched_4bsd.c Wed Aug 22 20:00:41 2012 (r239584)
+++ head/sys/kern/sched_4bsd.c Wed Aug 22 20:01:38 2012 (r239585)
@@ -1598,6 +1598,7 @@ sched_idletd(void *dummy)
{
struct pcpuidlestat *stat;
+ THREAD_NO_SLEEPING();
stat = DPCPU_PTR(idlestat);
for (;;) {
mtx_assert(&Giant, MA_NOTOWNED);
Modified: head/sys/kern/sched_ule.c
==============================================================================
--- head/sys/kern/sched_ule.c Wed Aug 22 20:00:41 2012 (r239584)
+++ head/sys/kern/sched_ule.c Wed Aug 22 20:01:38 2012 (r239585)
@@ -2581,6 +2581,7 @@ sched_idletd(void *dummy)
mtx_assert(&Giant, MA_NOTOWNED);
td = curthread;
tdq = TDQ_SELF();
+ THREAD_NO_SLEEPING();
for (;;) {
#ifdef SMP
if (tdq_idled(tdq) == 0)
Modified: head/sys/kern/subr_turnstile.c
==============================================================================
--- head/sys/kern/subr_turnstile.c Wed Aug 22 20:00:41 2012 (r239584)
+++ head/sys/kern/subr_turnstile.c Wed Aug 22 20:01:38 2012 (r239585)
@@ -684,6 +684,7 @@ turnstile_wait(struct turnstile *ts, str
if (owner)
MPASS(owner->td_proc->p_magic == P_MAGIC);
MPASS(queue == TS_SHARED_QUEUE || queue == TS_EXCLUSIVE_QUEUE);
+ KASSERT(!TD_IS_IDLETHREAD(td), ("idle threads cannot block on locks"));
/*
* If the lock does not already have a turnstile, use this thread's
More information about the svn-src-head
mailing list