Author: avg
Date: Mon Jan 23 08:34:51 2017
New Revision: 312666
URL: https://svnweb.freebsd.org/changeset/base/312666

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

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

Modified: stable/10/sys/kern/sched_4bsd.c
==============================================================================
--- stable/10/sys/kern/sched_4bsd.c     Mon Jan 23 08:34:41 2017        
(r312665)
+++ stable/10/sys/kern/sched_4bsd.c     Mon Jan 23 08:34:51 2017        
(r312666)
@@ -963,8 +963,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/10/sys/kern/sched_ule.c
==============================================================================
--- stable/10/sys/kern/sched_ule.c      Mon Jan 23 08:34:41 2017        
(r312665)
+++ stable/10/sys/kern/sched_ule.c      Mon Jan 23 08:34:51 2017        
(r312666)
@@ -1870,8 +1870,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))
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to