summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2014-08-23 17:31:56 +0000
committermav <mav@FreeBSD.org>2014-08-23 17:31:56 +0000
commitf7d85229614d9bd83f51c1e0c8f742d74427ed03 (patch)
treebd6c609b31947633a1fbdc87d6fc05a640029a51
parentc64bc288e77b214dab9e06f5e3626ea4a63e0c2b (diff)
downloadFreeBSD-src-f7d85229614d9bd83f51c1e0c8f742d74427ed03.zip
FreeBSD-src-f7d85229614d9bd83f51c1e0c8f742d74427ed03.tar.gz
Restore pre-r239157 handling of sched_yield(), when thread time slice was
aborted, allowing other threads to run. Without this change thread is just rescheduled again, that was illustrated by provided test tool. PR: 192926 Submitted by: eric@vangyzen.net MFC after: 2 weeks
-rw-r--r--sys/kern/sched_4bsd.c3
-rw-r--r--sys/kern/sched_ule.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c
index 2309ecb..3e39d55 100644
--- a/sys/kern/sched_4bsd.c
+++ b/sys/kern/sched_4bsd.c
@@ -982,7 +982,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);
+ preempted = !((td->td_flags & TDF_SLICEEND) ||
+ (flags & SWT_RELINQUISH));
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 12743b2..0a63c01 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -1857,7 +1857,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);
+ preempted = !((td->td_flags & TDF_SLICEEND) ||
+ (flags & SWT_RELINQUISH));
td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND);
td->td_owepreempt = 0;
if (!TD_IS_IDLETHREAD(td))
OpenPOWER on IntegriCloud