]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/commit
MFC r239157:
authormav <mav@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sat, 6 Oct 2012 12:51:16 +0000 (12:51 +0000)
committermav <mav@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sat, 6 Oct 2012 12:51:16 +0000 (12:51 +0000)
commitef2de22ca66c2d5f655c867d231ca20b67e52740
treefb382cb8693e3af15b91bacfad066235deb012d9
parent9a0bdc4eaed37be229fb9fa12eabc008af2b938a
MFC r239157:
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.

git-svn-id: svn://svn.freebsd.org/base/stable/9@241248 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/kern/sched_4bsd.c
sys/kern/sched_ule.c