summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2017-01-23 08:34:51 +0000
committeravg <avg@FreeBSD.org>2017-01-23 08:34:51 +0000
commit7d16c41cbfca369078cbaf60ac4a6b751d526c49 (patch)
treea73141af0ac8a5eb172930f145df37f2253a6e79 /sys/kern
parentedf4f428274bef424d31790d40cc3d81ebdfe0f2 (diff)
downloadFreeBSD-src-7d16c41cbfca369078cbaf60ac4a6b751d526c49.zip
FreeBSD-src-7d16c41cbfca369078cbaf60ac4a6b751d526c49.tar.gz
MFC r312426: fix a thread preemption regression in schedulers introduced
in r270423
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/sched_4bsd.c4
-rw-r--r--sys/kern/sched_ule.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c
index db23e1d..7309ae3 100644
--- a/sys/kern/sched_4bsd.c
+++ b/sys/kern/sched_4bsd.c
@@ -963,8 +963,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 30aad12..53a46c9 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -1870,8 +1870,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))
OpenPOWER on IntegriCloud