svn commit: r202940 - head/sys/kern

Attilio Rao attilio at FreeBSD.org
Sun Jan 24 18:16:39 UTC 2010


Author: attilio
Date: Sun Jan 24 18:16:38 2010
New Revision: 202940
URL: http://svn.freebsd.org/changeset/base/202940

Log:
  Split out an invariant in order to better check that newtd, when
  provided, must be on a runqueue.
  
  Tested by:	Giovanni Trematerra
  		<giovanni dot trematerra at gmail dot com>
  MFC:		2 weeks
  X-MFC:		r202889

Modified:
  head/sys/kern/sched_4bsd.c

Modified: head/sys/kern/sched_4bsd.c
==============================================================================
--- head/sys/kern/sched_4bsd.c	Sun Jan 24 18:05:38 2010	(r202939)
+++ head/sys/kern/sched_4bsd.c	Sun Jan 24 18:16:38 2010	(r202940)
@@ -943,8 +943,10 @@ sched_switch(struct thread *td, struct t
 	if ((td->td_flags & TDF_NOLOAD) == 0)
 		sched_load_rem();
 
-	if (newtd)
+	if (newtd) {
+		MPASS(newtd->td_lock == &sched_lock);
 		newtd->td_flags |= (td->td_flags & TDF_NEEDRESCHED);
+	}
 
 	td->td_lastcpu = td->td_oncpu;
 	td->td_flags &= ~TDF_NEEDRESCHED;
@@ -987,8 +989,8 @@ sched_switch(struct thread *td, struct t
 			sched_load_add();
 	} else {
 		newtd = choosethread();
+		MPASS(newtd->td_lock == &sched_lock);
 	}
-	MPASS(newtd->td_lock == &sched_lock);
 
 	if (td != newtd) {
 #ifdef	HWPMC_HOOKS


More information about the svn-src-head mailing list