From 0840c3f8113ffedd2ede7d6ffec603f90e6d39a7 Mon Sep 17 00:00:00 2001 From: avg Date: Tue, 24 Jan 2017 12:15:10 +0000 Subject: [PATCH] MFC r312426: fix a thread preemption regression in schedulers introduced in r270423 git-svn-id: svn://svn.freebsd.org/base/stable/9@312695 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/kern/sched_4bsd.c | 4 ++-- sys/kern/sched_ule.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index cae701535..da7ebe15c 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -985,8 +985,8 @@ sched_switch(struct thread *td, struct thread *newtd, int flags) 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; diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 73b3ef9d2..f3d2ebce3 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -1838,8 +1838,8 @@ sched_switch(struct thread *td, struct thread *newtd, int flags) 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)) -- 2.45.0