sched: Implement a gentler fair-sleepers feature

Add back FAIR_SLEEPERS and GENTLE_FAIR_SLEEPERS.

FAIR_SLEEPERS is the old logic: credit sleepers with their sleep time.

GENTLE_FAIR_SLEEPERS dampens this a bit: 50% of their sleep time gets
credited.

The hope here is to still give the benefits of fair-sleepers logic
(quick wakeups, etc.) while not allow them to have 100% of their
sleep time as if they were running.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Ingo Molnar 2009-09-16 08:54:45 +02:00
parent 59abf02644
commit 51e0304ce6
2 changed files with 16 additions and 2 deletions

View file

@ -711,7 +711,7 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
if (!initial) { if (!initial) {
/* sleeps upto a single latency don't count. */ /* sleeps upto a single latency don't count. */
if (sched_feat(NEW_FAIR_SLEEPERS)) { if (sched_feat(FAIR_SLEEPERS)) {
unsigned long thresh = sysctl_sched_latency; unsigned long thresh = sysctl_sched_latency;
/* /*
@ -725,6 +725,13 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
task_of(se)->policy != SCHED_IDLE)) task_of(se)->policy != SCHED_IDLE))
thresh = calc_delta_fair(thresh, se); thresh = calc_delta_fair(thresh, se);
/*
* Halve their sleep time's effect, to allow
* for a gentler effect of sleepers:
*/
if (sched_feat(GENTLE_FAIR_SLEEPERS))
thresh >>= 1;
vruntime -= thresh; vruntime -= thresh;
} }
} }

View file

@ -3,7 +3,14 @@
* considers the task to be running during that period. This gives it * considers the task to be running during that period. This gives it
* a service deficit on wakeup, allowing it to run sooner. * a service deficit on wakeup, allowing it to run sooner.
*/ */
SCHED_FEAT(NEW_FAIR_SLEEPERS, 0) SCHED_FEAT(FAIR_SLEEPERS, 1)
/*
* Only give sleepers 50% of their service deficit. This allows
* them to run sooner, but does not allow tons of sleepers to
* rip the spread apart.
*/
SCHED_FEAT(GENTLE_FAIR_SLEEPERS, 1)
/* /*
* By not normalizing the sleep time, heavy tasks get an effective * By not normalizing the sleep time, heavy tasks get an effective