Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Jan 2010 18:16:38 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r202940 - head/sys/kern
Message-ID:  <201001241816.o0OIGcL0005353@svn.freebsd.org>

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



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