Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Jul 2016 20:19:14 +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: r303503 - head/sys/kern
Message-ID:  <201607292019.u6TKJE98050271@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607292019.u6TKJE98050271>