From patchwork Wed Dec 12 13:31:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 1866241 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id EE55EDF2EE for ; Wed, 12 Dec 2012 13:36:21 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TimRP-0007ky-U5; Wed, 12 Dec 2012 13:33:41 +0000 Received: from mail-wi0-f173.google.com ([209.85.212.173]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TimQN-0007Rg-Ip for linux-arm-kernel@lists.infradead.org; Wed, 12 Dec 2012 13:32:44 +0000 Received: by mail-wi0-f173.google.com with SMTP id hn17so2652113wib.0 for ; Wed, 12 Dec 2012 05:32:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=rCXmVIXV5GZ1OnZVoK91ZBjr9qWuY6NxzAHry90c0rg=; b=dVd4LvH05go4rCu/QdTs1SjLyQElJGpUBNfgmfObbXmNNd73+EJUJkTftzRvQKXWAV dxGt4qkvS/eL2DV/t6GbEWZE3uOr0li48isM8Br8dRaOjVRFhkJWhO95rn8biYtojdJ7 aoUf/kiCu3hlEfPhwz5W5SCfNRpBESsHHqeJ5KAb1xKuaoI9wYNQzVxnxjQEKByePb5O OVTwZnygSpmTeQWlFqiC+LSdDRPxviM57/+BZzg22dFDiCvuaBcXaFZajMQmk/dHMpDC Zvf0C2U/49hPU2oBxVOQmnOPbY2/ckZ3LBKslRRx1CtIy2pbaWZpo/AZZKfFAfMq+w+E qnxg== Received: by 10.180.75.135 with SMTP id c7mr22897707wiw.10.1355319155213; Wed, 12 Dec 2012 05:32:35 -0800 (PST) Received: from localhost.localdomain (LPuteaux-156-14-44-212.w82-127.abo.wanadoo.fr. [82.127.83.212]) by mx.google.com with ESMTPS id t17sm21269650wiv.6.2012.12.12.05.32.33 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 12 Dec 2012 05:32:34 -0800 (PST) From: Vincent Guittot To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-dev@lists.linaro.org, peterz@infradead.org, mingo@kernel.org, linux@arm.linux.org.uk, pjt@google.com, santosh.shilimkar@ti.com, Morten.Rasmussen@arm.com, chander.kashyap@linaro.org, cmetcalf@tilera.com, tony.luck@intel.com Subject: [RFC PATCH v2 5/6] sched: pack the idle load balance Date: Wed, 12 Dec 2012 14:31:31 +0100 Message-Id: <1355319092-30980-6-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1355319092-30980-1-git-send-email-vincent.guittot@linaro.org> References: <1355319092-30980-1-git-send-email-vincent.guittot@linaro.org> X-Gm-Message-State: ALoCoQkCNJ1iBLLhBlKMh+LQ6Ru9gDyqndo4uf5lAcO6McDUOtDiaa/cQoCEjTamqaaq9W1RzfUG X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121212_083236_247689_B4969C60 X-CRM114-Status: GOOD ( 12.80 ) X-Spam-Score: 0.4 (/) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (0.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.173 listed in list.dnswl.org] 3.0 KHOP_BIG_TO_CC Sent to 10+ recipients instaed of Bcc or a list -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: len.brown@intel.com, alex.shi@intel.com, Vincent Guittot , viresh.kumar@linaro.org, amit.kucheria@linaro.org, preeti@linux.vnet.ibm.com, tglx@linutronix.de, paulmck@linux.vnet.ibm.com, arjan@linux.intel.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Look for an idle CPU close to the pack buddy CPU whenever possible. The goal is to prevent the wake up of a CPU which doesn't share the power domain of the pack buddy 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 f1a4c24..6475f54 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7274,7 +7274,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;