[PATCH v8 03/10] sched: move cfs task on a CPU with higher capacity
From: vincent.guittot@linaro.org (Vincent Guittot)
Date: 2014-11-04 11:11:04
Also in:
lkml
On 4 November 2014 11:42, Wanpeng Li [off-list ref] wrote:
Hi Vincent,quoted
quoted
quoted
+ +/* * Group imbalance indicates (and tries to solve) the problem where balancing * groups is inadequate due to tsk_cpus_allowed() constraints. *@@ -6562,6 +6574,28 @@ static int need_active_balance(struct lb_env*env) return 1; } + /* + * The dst_cpu is idle and the src_cpu CPU has only 1 CFS task.Why specify one task instead of not less than one?if cfs.h_nr_running == 0 (which should not occurs at that point), we don't need to do more test to check if it's worth moving the task because there is no task to move.Sorry for my confusing statement. I mean cfs.h_nr_running >= 1.
ok. If we have more than 1 task, we fall back into the default balancing policy than should move a not running task or that will use the imbalance field in case of the presence of pinned tasks Regards, Vincent
Regards, Wanpeng Liquoted
Regards, Vincentquoted
Regards, Wanpeng Liquoted
+ * It's worth migrating the task if the src_cpu's capacity is reduced + * because of other sched_class or IRQs whereas capacity stays + * available on dst_cpu. + */ + if ((env->idle != CPU_NOT_IDLE) && + (env->src_rq->cfs.h_nr_running == 1)) { + unsigned long src_eff_capacity, dst_eff_capacity; + + dst_eff_capacity = 100; + dst_eff_capacity *= capacity_of(env->dst_cpu); + dst_eff_capacity *= capacity_orig_of(env->src_cpu); + + src_eff_capacity = sd->imbalance_pct; + src_eff_capacity *= capacity_of(env->src_cpu); + src_eff_capacity *= capacity_orig_of(env->dst_cpu); + + if (src_eff_capacity < dst_eff_capacity) + return 1; + } +