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;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to