svn commit: r312695 - stable/9/sys/kern

Andriy Gapon avg at FreeBSD.org
Tue Jan 24 12:15:11 UTC 2017


Author: avg
Date: Tue Jan 24 12:15:10 2017
New Revision: 312695
URL: https://svnweb.freebsd.org/changeset/base/312695

Log:
  MFC r312426: fix a thread preemption regression in schedulers introduced
  in r270423

Modified:
  stable/9/sys/kern/sched_4bsd.c
  stable/9/sys/kern/sched_ule.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/sched_4bsd.c
==============================================================================
--- stable/9/sys/kern/sched_4bsd.c	Tue Jan 24 12:13:41 2017	(r312694)
+++ stable/9/sys/kern/sched_4bsd.c	Tue Jan 24 12:15:10 2017	(r312695)
@@ -985,8 +985,8 @@ sched_switch(struct thread *td, struct t
 		sched_load_rem();
 
 	td->td_lastcpu = td->td_oncpu;
-	preempted = !((td->td_flags & TDF_SLICEEND) ||
-	    (flags & SWT_RELINQUISH));
+	preempted = (td->td_flags & TDF_SLICEEND) == 0 &&
+	    (flags & SW_PREEMPT) != 0;
 	td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND);
 	td->td_owepreempt = 0;
 	td->td_oncpu = NOCPU;

Modified: stable/9/sys/kern/sched_ule.c
==============================================================================
--- stable/9/sys/kern/sched_ule.c	Tue Jan 24 12:13:41 2017	(r312694)
+++ stable/9/sys/kern/sched_ule.c	Tue Jan 24 12:15:10 2017	(r312695)
@@ -1838,8 +1838,8 @@ sched_switch(struct thread *td, struct t
 	ts->ts_rltick = ticks;
 	td->td_lastcpu = td->td_oncpu;
 	td->td_oncpu = NOCPU;
-	preempted = !((td->td_flags & TDF_SLICEEND) ||
-	    (flags & SWT_RELINQUISH));
+	preempted = (td->td_flags & TDF_SLICEEND) == 0 &&
+	    (flags & SW_PREEMPT) != 0;
 	td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND);
 	td->td_owepreempt = 0;
 	if (!TD_IS_IDLETHREAD(td))


More information about the svn-src-all mailing list