Date: Fri, 21 May 2010 17:15:56 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r208391 - head/sys/kern Message-ID: <201005211715.o4LHFuP5079385@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Fri May 21 17:15:56 2010 New Revision: 208391 URL: http://svn.freebsd.org/changeset/base/208391 Log: Assert that the thread passed to sched_bind() and sched_unbind() is curthread as those routines are only supported for curthread currently. MFC after: 1 month Modified: head/sys/kern/sched_4bsd.c head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_4bsd.c ============================================================================== --- head/sys/kern/sched_4bsd.c Fri May 21 17:14:36 2010 (r208390) +++ head/sys/kern/sched_4bsd.c Fri May 21 17:15:56 2010 (r208391) @@ -1462,9 +1462,8 @@ sched_bind(struct thread *td, int cpu) { struct td_sched *ts; - THREAD_LOCK_ASSERT(td, MA_OWNED); - KASSERT(TD_IS_RUNNING(td), - ("sched_bind: cannot bind non-running thread")); + THREAD_LOCK_ASSERT(td, MA_OWNED|MA_NOTRECURSED); + KASSERT(td == curthread, ("sched_bind: can only bind curthread")); ts = td->td_sched; @@ -1482,6 +1481,7 @@ void sched_unbind(struct thread* td) { THREAD_LOCK_ASSERT(td, MA_OWNED); + KASSERT(td == curthread, ("sched_unbind: can only bind curthread")); td->td_flags &= ~TDF_BOUND; } Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Fri May 21 17:14:36 2010 (r208390) +++ head/sys/kern/sched_ule.c Fri May 21 17:15:56 2010 (r208391) @@ -2427,6 +2427,7 @@ sched_bind(struct thread *td, int cpu) struct td_sched *ts; THREAD_LOCK_ASSERT(td, MA_OWNED|MA_NOTRECURSED); + KASSERT(td == curthread, ("sched_bind: can only bind curthread")); ts = td->td_sched; if (ts->ts_flags & TSF_BOUND) sched_unbind(td); @@ -2448,6 +2449,7 @@ sched_unbind(struct thread *td) struct td_sched *ts; THREAD_LOCK_ASSERT(td, MA_OWNED); + KASSERT(td == curthread, ("sched_unbind: can only bind curthread")); ts = td->td_sched; if ((ts->ts_flags & TSF_BOUND) == 0) return;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005211715.o4LHFuP5079385>