svn commit: r303503 - head/sys/kern

John Baldwin jhb at FreeBSD.org
Fri Jul 29 20:19:15 UTC 2016


Author: jhb
Date: Fri Jul 29 20:19:14 2016
New Revision: 303503
URL: https://svnweb.freebsd.org/changeset/base/303503

Log:
  Don't treat NOCPU as a valid CPU to CPU_ISSET.
  
  If a thread is created bound to a cpuset it might already be bound before
  it's very first timeslice, and td_lastcpu will be NOCPU in that case.
  
  MFC after:	1 week

Modified:
  head/sys/kern/sched_4bsd.c

Modified: head/sys/kern/sched_4bsd.c
==============================================================================
--- head/sys/kern/sched_4bsd.c	Fri Jul 29 19:36:10 2016	(r303502)
+++ head/sys/kern/sched_4bsd.c	Fri Jul 29 20:19:14 2016	(r303503)
@@ -1241,7 +1241,7 @@ sched_pickcpu(struct thread *td)
 
 	mtx_assert(&sched_lock, MA_OWNED);
 
-	if (THREAD_CAN_SCHED(td, td->td_lastcpu))
+	if (td->td_lastcpu != NOCPU && THREAD_CAN_SCHED(td, td->td_lastcpu))
 		best = td->td_lastcpu;
 	else
 		best = NOCPU;


More information about the svn-src-head mailing list