sched: encourage idle load balance and discourage active load balance
Encourage IDLE and NEWLY_IDLE load balance by ignoring cache hotness and discourage active load balance when by increasing busy balancing failure threshold to initiate active load balancer in order to reduce scheduler latency and avoid unnecessary active migration within a same domain. Change-Id: I22f6aba11932ccbb82a436c0532589c46f9148ed Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org> [pkondeti@codeaurora.org: resolved minor merge conflicts] Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
This commit is contained in:
parent
a330f3d5bc
commit
b9c755e46f
|
@ -6275,12 +6275,13 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env)
|
|||
|
||||
/*
|
||||
* Aggressive migration if:
|
||||
* 1) task is cache cold, or
|
||||
* 2) too many balance attempts have failed.
|
||||
* 1) IDLE or NEWLY_IDLE balance.
|
||||
* 2) task is cache cold, or
|
||||
* 3) too many balance attempts have failed.
|
||||
*/
|
||||
|
||||
tsk_cache_hot = task_hot(p, rq_clock_task(env->src_rq), env->sd);
|
||||
if (!tsk_cache_hot ||
|
||||
if (env->idle != CPU_NOT_IDLE || !tsk_cache_hot ||
|
||||
env->sd->nr_balance_failed > env->sd->cache_nice_tries) {
|
||||
|
||||
if (tsk_cache_hot) {
|
||||
|
@ -7532,6 +7533,8 @@ static struct rq *find_busiest_queue(struct lb_env *env,
|
|||
/* Working cpumask for load_balance and load_balance_newidle. */
|
||||
DEFINE_PER_CPU(cpumask_var_t, load_balance_mask);
|
||||
|
||||
#define NEED_ACTIVE_BALANCE_THRESHOLD 10
|
||||
|
||||
static int need_active_balance(struct lb_env *env)
|
||||
{
|
||||
struct sched_domain *sd = env->sd;
|
||||
|
@ -7550,7 +7553,8 @@ static int need_active_balance(struct lb_env *env)
|
|||
return 1;
|
||||
}
|
||||
|
||||
return unlikely(sd->nr_balance_failed > sd->cache_nice_tries+2);
|
||||
return unlikely(sd->nr_balance_failed >
|
||||
sd->cache_nice_tries + NEED_ACTIVE_BALANCE_THRESHOLD);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -7762,7 +7766,9 @@ no_move:
|
|||
* We've kicked active balancing, reset the failure
|
||||
* counter.
|
||||
*/
|
||||
sd->nr_balance_failed = sd->cache_nice_tries+1;
|
||||
sd->nr_balance_failed =
|
||||
sd->cache_nice_tries +
|
||||
NEED_ACTIVE_BALANCE_THRESHOLD - 1;
|
||||
}
|
||||
} else {
|
||||
sd->nr_balance_failed = 0;
|
||||
|
|
Loading…
Reference in New Issue