Commit fde7d22e authored by Yuyang Du's avatar Yuyang Du Committed by Ingo Molnar

sched/fair: Fix overly small weight for interactive group entities

Commit:

  9d89c257 ("sched/fair: Rewrite runnable load and utilization average tracking")

led to an overly small weight for interactive group entities. The bad case
can be easily reproduced when a number of CPU hogs compete for the CPUs
at the same time (thanks to Mike). This is largly because the task group's
load average tracking cross CPUs lags behind the real changes.

To fix this we accelerate the group share distribution process by using
the load.weight of the cfs_rq. This may increase the entire group's
share, but we have to do so to protect the (fragile) interactive
tasks, especially from CPU hogs.
Reported-by: default avatarMike Galbraith <umgwanakikbuti@gmail.com>
Tested-by: default avatarDietmar Eggemann <dietmar.eggemann@arm.com>
Tested-by: default avatarMike Galbraith <umgwanakikbuti@gmail.com>
Signed-off-by: default avatarYuyang Du <yuyang.du@intel.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: default avatarDietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1444699103-20272-1-git-send-email-yuyang.du@intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 9babcd79
...@@ -2363,7 +2363,7 @@ static inline long calc_tg_weight(struct task_group *tg, struct cfs_rq *cfs_rq) ...@@ -2363,7 +2363,7 @@ static inline long calc_tg_weight(struct task_group *tg, struct cfs_rq *cfs_rq)
*/ */
tg_weight = atomic_long_read(&tg->load_avg); tg_weight = atomic_long_read(&tg->load_avg);
tg_weight -= cfs_rq->tg_load_avg_contrib; tg_weight -= cfs_rq->tg_load_avg_contrib;
tg_weight += cfs_rq_load_avg(cfs_rq); tg_weight += cfs_rq->load.weight;
return tg_weight; return tg_weight;
} }
...@@ -2373,7 +2373,7 @@ static long calc_cfs_shares(struct cfs_rq *cfs_rq, struct task_group *tg) ...@@ -2373,7 +2373,7 @@ static long calc_cfs_shares(struct cfs_rq *cfs_rq, struct task_group *tg)
long tg_weight, load, shares; long tg_weight, load, shares;
tg_weight = calc_tg_weight(tg, cfs_rq); tg_weight = calc_tg_weight(tg, cfs_rq);
load = cfs_rq_load_avg(cfs_rq); load = cfs_rq->load.weight;
shares = (tg->shares * load); shares = (tg->shares * load);
if (tg_weight) if (tg_weight)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment