Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967075AbbBDSbz (ORCPT ); Wed, 4 Feb 2015 13:31:55 -0500 Received: from foss-mx-na.foss.arm.com ([217.140.108.86]:41731 "EHLO foss-mx-na.foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967047AbbBDSbv (ORCPT ); Wed, 4 Feb 2015 13:31:51 -0500 From: Morten Rasmussen To: peterz@infradead.org, mingo@redhat.com Cc: vincent.guittot@linaro.org, dietmar.eggemann@arm.com, yuyang.du@intel.com, preeti@linux.vnet.ibm.com, mturquette@linaro.org, nico@linaro.org, rjw@rjwysocki.net, juri.lelli@arm.com, linux-kernel@vger.kernel.org Subject: [RFCv3 PATCH 43/48] sched: Introduce energy awareness into detach_tasks Date: Wed, 4 Feb 2015 18:31:20 +0000 Message-Id: <1423074685-6336-44-git-send-email-morten.rasmussen@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1423074685-6336-1-git-send-email-morten.rasmussen@arm.com> References: <1423074685-6336-1-git-send-email-morten.rasmussen@arm.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2275 Lines: 80 From: Dietmar Eggemann Energy-aware load balancing does not rely on env->imbalance but instead it evaluates the system-wide energy difference for each task on the src rq by potentially moving it to the dst rq. If this energy difference is lesser than zero the task is actually moved from src to dst rq. cc: Ingo Molnar cc: Peter Zijlstra Signed-off-by: Dietmar Eggemann --- kernel/sched/fair.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 48cd5b5..6b79603 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6095,12 +6095,12 @@ static int detach_tasks(struct lb_env *env) { struct list_head *tasks = &env->src_rq->cfs_tasks; struct task_struct *p; - unsigned long load; + unsigned long load = 0; int detached = 0; lockdep_assert_held(&env->src_rq->lock); - if (env->imbalance <= 0) + if (!env->use_ea && env->imbalance <= 0) return 0; while (!list_empty(tasks)) { @@ -6121,6 +6121,20 @@ static int detach_tasks(struct lb_env *env) if (!can_migrate_task(p, env)) goto next; + if (env->use_ea) { + struct energy_env eenv = { + .src_cpu = env->src_cpu, + .dst_cpu = env->dst_cpu, + .usage_delta = task_utilization(p), + }; + int e_diff = energy_diff(&eenv); + + if (e_diff >= 0) + goto next; + + goto detach; + } + load = task_h_load(p); if (sched_feat(LB_MIN) && load < 16 && !env->sd->nr_balance_failed) @@ -6129,6 +6143,7 @@ static int detach_tasks(struct lb_env *env) if ((load / 2) > env->imbalance) goto next; +detach: detach_task(p, env); list_add(&p->se.group_node, &env->tasks); @@ -6149,7 +6164,7 @@ static int detach_tasks(struct lb_env *env) * We only want to steal up to the prescribed amount of * weighted load. */ - if (env->imbalance <= 0) + if (!env->use_ea && env->imbalance <= 0) break; continue; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/