]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Rework r220198 change (by fabient). I believe it solves the problem from
authorAlexander Motin <mav@FreeBSD.org>
Thu, 9 Aug 2012 19:26:13 +0000 (19:26 +0000)
committerAlexander Motin <mav@FreeBSD.org>
Thu, 9 Aug 2012 19:26:13 +0000 (19:26 +0000)
commit3d7f41175dddea95e605d034f272b86b3cc35654
tree0309debb19e0fbda2144215613bcee44d7097bc7
parent81b0715a13503ae8f140b17295acd4a0a6928270
Rework r220198 change (by fabient). I believe it solves the problem from
the wrong direction. Before it, if preemption and end of time slice happen
same time, thread was put to the head of the queue as for only preemption.
It could cause single thread to run for indefinitely long time. r220198
handles it by not clearing TDF_NEEDRESCHED in case of preemption. But that
causes delayed context switch every time preemption happens, even when not
needed.

Solve problem by introducing scheduler-specifoc thread flag TDF_SLICEEND,
set when thread's time slice is over and it should be put to the tail of
queue. Using SW_PREEMPT flag for that purpose as it was before just not
enough informative to work correctly.

On my tests this by 2-3 times reduces run time deviation (improves fairness)
in cases when several threads share one CPU.

Reviewed by: fabient
MFC after: 2 months
Sponsored by: iXsystems, Inc.
sys/kern/sched_4bsd.c
sys/kern/sched_ule.c