From patchwork Sun Oct 7 07:43:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 12038 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id F134A23EFF for ; Sun, 7 Oct 2012 07:44:44 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id A128AA19440 for ; Sun, 7 Oct 2012 07:44:44 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so6872053iej.11 for ; Sun, 07 Oct 2012 00:44:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=jRtP0/8FbFifqWUSNAPMd5FGCQEDn9fuDMEKy/pfZmQ=; b=F9S0/ROP4qsKggHfXrKSj3LtavZc1A8aF09Si4tYNxSHXnzH9/7QhpJiikAS/xZBhC JRqFZSU/16RLeMwhpT2bUn6xscckgwb5wwuhuolhTLBUffwAaV8iixhSomQ1RQe0/dPz 24iPGSBpDAxPFOp6EJx3RsTwoqvtblVqBtSiJnh9DS56vjbL0CDQA4EwU6gfqMlCEQLg eT+mHVmYPViLNEAlKCBU7u9vG8F3+7xrD9cS3Axxt7mHBOIyGSJ43coFp7Gj3XOd35T6 mC0asZUPtxE7QX8zE3pfUJ1bmZRRypxwS/FaCSGtLw2D483u/+smn4bfvIrrMyPeCZh+ E7Ww== Received: by 10.50.150.198 with SMTP id uk6mr5177802igb.43.1349595884405; Sun, 07 Oct 2012 00:44:44 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp39956igc; Sun, 7 Oct 2012 00:44:43 -0700 (PDT) Received: by 10.180.80.104 with SMTP id q8mr13386394wix.6.1349595883053; Sun, 07 Oct 2012 00:44:43 -0700 (PDT) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx.google.com with ESMTPS id ej4si12016670wid.6.2012.10.07.00.44.42 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 07 Oct 2012 00:44:43 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.50 is neither permitted nor denied by best guess record for domain of vincent.guittot@linaro.org) client-ip=74.125.82.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.50 is neither permitted nor denied by best guess record for domain of vincent.guittot@linaro.org) smtp.mail=vincent.guittot@linaro.org Received: by mail-wg0-f50.google.com with SMTP id 16so2511087wgi.31 for ; Sun, 07 Oct 2012 00:44:42 -0700 (PDT) Received: by 10.180.80.100 with SMTP id q4mr520809wix.20.1349595882610; Sun, 07 Oct 2012 00:44:42 -0700 (PDT) Received: from lmenx30s.lme.st.com (pas72-1-88-161-60-229.fbx.proxad.net. [88.161.60.229]) by mx.google.com with ESMTPS id j8sm12495245wiy.9.2012.10.07.00.44.40 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 07 Oct 2012 00:44:42 -0700 (PDT) From: Vincent Guittot To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-dev@lists.linaro.org, peterz@infradead.org, mingo@redhat.com, pjt@google.com, linux@arm.linux.org.uk Cc: Vincent Guittot Subject: [RFC 5/6] sched: pack the idle load balance Date: Sun, 7 Oct 2012 09:43:57 +0200 Message-Id: <1349595838-31274-6-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1349595838-31274-1-git-send-email-vincent.guittot@linaro.org> References: <1349595838-31274-1-git-send-email-vincent.guittot@linaro.org> X-Gm-Message-State: ALoCoQn4GTtXluWwveDclfZQc2/QIZa/Bt0lhH6/e6o+cqgzmluqGC1RawSaSIKTXa381uYXxBQw Look for an idle CPU close the pack buddy CPU whenever possible. The goal is to prevent the wake up of a CPU which doesn't share the power line of the pack CPU Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 6df53b5..f76acdc 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5158,7 +5158,25 @@ static struct { static inline int find_new_ilb(int call_cpu) { + struct sched_domain *sd; int ilb = cpumask_first(nohz.idle_cpus_mask); + int buddy = per_cpu(sd_pack_buddy, call_cpu); + + /* + * If we have a pack buddy CPU, we try to run load balance on a CPU + * that is close to the buddy. + */ + if (buddy != -1) + for_each_domain(buddy, sd) { + if (sd->flags & SD_SHARE_CPUPOWER) + continue; + + ilb = cpumask_first_and(sched_domain_span(sd), + nohz.idle_cpus_mask); + + if (ilb < nr_cpu_ids) + break; + } if (ilb < nr_cpu_ids && idle_cpu(ilb)) return ilb;