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
This commit is contained in:
Alexander Motin 2014-08-23 17:31:56 +00:00
parent ce470233d4
commit 2e7d7bb294
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=270423
2 changed files with 4 additions and 2 deletions

View File

@ -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;

View File

@ -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))