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: 13509 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 855AB23E2A for ; Wed, 12 Dec 2012 13:32:37 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 4EAC4A1999C for ; Wed, 12 Dec 2012 13:32:37 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id t4so848659iag.11 for ; Wed, 12 Dec 2012 05:32:36 -0800 (PST) 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=rCXmVIXV5GZ1OnZVoK91ZBjr9qWuY6NxzAHry90c0rg=; b=OxjmlQD09tIUFaJKtY6ny1kTLRkvqRW5it8p98PlgPHHzLFvza0EJH6bybdRdK5MI7 jx3X4hcaZtAdzB/efBAQ1UNvAkUWs9zAPU9VgPFX8eSd2DhXDWYb+swgu58Co0eu9JPD SIM4O7LQ3P+eTYG8oJH8vIwTL8VOufZy+LidI+CEt3zSjLgQI58LR0g7RIc260+YoobC XISTOhw/WhqH/ojzl6IfOVSvPx/0Cpg62aJMGbtJbQTu9sCLOnZvYiPvSnH/OHXnG+cR c29hV5ZEyOCO6rifoc94fmWYMCJYlmHoPU6M/8u+1aK5ZHOv2zQimf26Ev+9s+9oGTUC fqpQ== Received: by 10.50.173.34 with SMTP id bh2mr819786igc.70.1355319156677; Wed, 12 Dec 2012 05:32:36 -0800 (PST) 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.67.148 with SMTP id n20csp199599igt; Wed, 12 Dec 2012 05:32:36 -0800 (PST) Received: by 10.180.24.70 with SMTP id s6mr18108505wif.22.1355319155708; Wed, 12 Dec 2012 05:32:35 -0800 (PST) Received: from mail-wg0-f52.google.com (mail-wg0-f52.google.com [74.125.82.52]) by mx.google.com with ESMTPS id ex5si19408821wib.12.2012.12.12.05.32.35 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 12 Dec 2012 05:32:35 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.52 is neither permitted nor denied by best guess record for domain of vincent.guittot@linaro.org) client-ip=74.125.82.52; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.52 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-f52.google.com with SMTP id 12so272312wgh.31 for ; Wed, 12 Dec 2012 05:32:35 -0800 (PST) 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 Cc: alex.shi@intel.com, preeti@linux.vnet.ibm.com, paulmck@linux.vnet.ibm.com, tglx@linutronix.de, len.brown@intel.com, arjan@linux.intel.com, amit.kucheria@linaro.org, viresh.kumar@linaro.org, Vincent Guittot 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: ALoCoQn0a/PeFD0TXj/cPm2nGb48sDD2zMsUbfe1I7jOip0rk2d82jDWjTYY1yKT5ZsRPP2JcMpA 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;