From patchwork Fri May 23 18:16:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Morten Rasmussen X-Patchwork-Id: 30844 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1ECD120369 for ; Fri, 23 May 2014 18:17:33 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id rd18sf25133948iec.0 for ; Fri, 23 May 2014 11:17:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=hKelc0asMN0oojTrtARQm3F6z0rqF6B9+zY5jc7javY=; b=JIuMnWaKDa+BkITP6nc6/0J8hmluVGGFmeBIwiECg/1QnWcyinoPkY9adX0L9HVcOm 1RpkwJxe7s0PBRvMdom29C2qskyrZevra5AtWyLQzGkTBjQU1w9yO3N2UbI6axmrgKXt xl/KxgaYqsTtiEdU3Fyh8tgvku151sHYYiugHiEEml1gTCMKWaqcP4/Np75FouzvC6fK TMfU+oLr2Fm1XrATlNnJxyGMw3j6y7Qdjh62TbdQKu6nTiQ9TDy90sTqh9Hw2PylM4MS R+wguA5+MmiLgNdtMqKxybjX+7DVDnIhzKAsy4HLrMLXo5x7mGF38flJmLxYcklp0J8i iznA== X-Gm-Message-State: ALoCoQltNyW6IfRLCQ3z5FUsL5kUug1czbAF2aHoWAAWbG7At8R8QJvs6eAJqpoS6+I75WLd7ZxG X-Received: by 10.182.241.9 with SMTP id we9mr2947499obc.22.1400869052512; Fri, 23 May 2014 11:17:32 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.26.183 with SMTP id 52ls1913182qgv.15.gmail; Fri, 23 May 2014 11:17:32 -0700 (PDT) X-Received: by 10.58.160.164 with SMTP id xl4mr2693455veb.38.1400869052391; Fri, 23 May 2014 11:17:32 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id qo14si1106379vdb.23.2014.05.23.11.17.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 11:17:32 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id lf12so6731496vcb.1 for ; Fri, 23 May 2014 11:17:32 -0700 (PDT) X-Received: by 10.52.12.36 with SMTP id v4mr4830210vdb.20.1400869052322; Fri, 23 May 2014 11:17:32 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp52300vcb; Fri, 23 May 2014 11:17:31 -0700 (PDT) X-Received: by 10.66.231.40 with SMTP id td8mr8210820pac.103.1400869051588; Fri, 23 May 2014 11:17:31 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hb5si5012274pac.125.2014.05.23.11.17.31; Fri, 23 May 2014 11:17:31 -0700 (PDT) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751746AbaEWSRA (ORCPT + 12 others); Fri, 23 May 2014 14:17:00 -0400 Received: from service87.mimecast.com ([91.220.42.44]:36439 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751685AbaEWSQ5 (ORCPT ); Fri, 23 May 2014 14:16:57 -0400 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Fri, 23 May 2014 19:16:55 +0100 Received: from e103034-lin.cambridge.arm.com ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 23 May 2014 19:16:55 +0100 From: Morten Rasmussen To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, peterz@infradead.org, mingo@kernel.org Cc: rjw@rjwysocki.net, vincent.guittot@linaro.org, daniel.lezcano@linaro.org, preeti@linux.vnet.ibm.com, dietmar.eggemann@arm.com Subject: [RFC PATCH 14/16] sched: Use energy model in select_idle_sibling Date: Fri, 23 May 2014 19:16:41 +0100 Message-Id: <1400869003-27769-15-git-send-email-morten.rasmussen@arm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1400869003-27769-1-git-send-email-morten.rasmussen@arm.com> References: <1400869003-27769-1-git-send-email-morten.rasmussen@arm.com> X-OriginalArrivalTime: 23 May 2014 18:16:55.0838 (UTC) FILETIME=[2DE723E0:01CF76B3] X-MC-Unique: 114052319165517301 Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: morten.rasmussen@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Make select_idle_sibling() consider energy when picking an idle cpu. Only idle cpus are still considered. A more aggressive energy conserving approach could go further and consider partly utilized cpus. Signed-off-by: Morten Rasmussen --- kernel/sched/fair.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 5a52467..542c2b2 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4644,7 +4644,9 @@ static int select_idle_sibling(struct task_struct *p, int target) struct sched_domain *sd; struct sched_group *sg; int i = task_cpu(p); + int target_energy; +#ifndef CONFIG_SCHED_ENERGY if (idle_cpu(target)) return target; @@ -4653,6 +4655,8 @@ static int select_idle_sibling(struct task_struct *p, int target) */ if (i != target && cpus_share_cache(i, target) && idle_cpu(i)) return i; +#endif + target_energy = energy_diff_task(target, p); /* * Otherwise, iterate the domains and find an elegible idle cpu. @@ -4666,8 +4670,12 @@ static int select_idle_sibling(struct task_struct *p, int target) goto next; for_each_cpu(i, sched_group_cpus(sg)) { + int diff; if (i == target || !idle_cpu(i)) goto next; + diff = energy_diff_task(i, p); + if (diff > target_energy) + goto next; } target = cpumask_first_and(sched_group_cpus(sg),