sched: tidy up and simplify the bonus balance
make the bonus balance more consistent: do not hand out a bonus if there's too much in flight already, and only deduct as much from a runner as it has the capacity. This makes the bonus engine a zero-sum game (as intended). this also simplifies the code: text data bss dec hex filename 34770 2998 24 37792 93a0 sched.o.before 34749 2998 24 37771 938b sched.o.after and it also avoids overscheduling in sleep-happy workloads like hackbench.c. Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
98fbc79853
commit
b2133c8b1e
|
@ -306,6 +306,8 @@ __update_curr(struct cfs_rq *cfs_rq, struct sched_entity *curr)
|
|||
delta = min(cfs_rq->sleeper_bonus, (u64)delta_exec);
|
||||
delta = calc_delta_mine(delta, curr->load.weight, lw);
|
||||
delta = min((u64)delta, cfs_rq->sleeper_bonus);
|
||||
delta = min(delta, (unsigned long)(
|
||||
(long)sysctl_sched_runtime_limit - curr->wait_runtime));
|
||||
cfs_rq->sleeper_bonus -= delta;
|
||||
delta_mine -= delta;
|
||||
}
|
||||
|
@ -493,6 +495,13 @@ static void __enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
|
|||
unsigned long load = cfs_rq->load.weight, delta_fair;
|
||||
long prev_runtime;
|
||||
|
||||
/*
|
||||
* Do not boost sleepers if there's too much bonus 'in flight'
|
||||
* already:
|
||||
*/
|
||||
if (unlikely(cfs_rq->sleeper_bonus > sysctl_sched_runtime_limit))
|
||||
return;
|
||||
|
||||
if (sysctl_sched_features & SCHED_FEAT_SLEEPER_LOAD_AVG)
|
||||
load = rq_of(cfs_rq)->cpu_load[2];
|
||||
|
||||
|
@ -512,16 +521,13 @@ static void __enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
|
|||
|
||||
prev_runtime = se->wait_runtime;
|
||||
__add_wait_runtime(cfs_rq, se, delta_fair);
|
||||
schedstat_add(cfs_rq, wait_runtime, se->wait_runtime);
|
||||
delta_fair = se->wait_runtime - prev_runtime;
|
||||
|
||||
/*
|
||||
* Track the amount of bonus we've given to sleepers:
|
||||
*/
|
||||
cfs_rq->sleeper_bonus += delta_fair;
|
||||
if (unlikely(cfs_rq->sleeper_bonus > sysctl_sched_runtime_limit))
|
||||
cfs_rq->sleeper_bonus = sysctl_sched_runtime_limit;
|
||||
|
||||
schedstat_add(cfs_rq, wait_runtime, se->wait_runtime);
|
||||
}
|
||||
|
||||
static void enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
|
||||
|
|
Loading…
Reference in New Issue