From patchwork Fri Mar 22 12:25:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 15538 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 DBBC923DEE for ; Fri, 22 Mar 2013 12:29:46 +0000 (UTC) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by fiordland.canonical.com (Postfix) with ESMTP id 97F4DA18211 for ; Fri, 22 Mar 2013 12:29:46 +0000 (UTC) Received: by mail-ve0-f170.google.com with SMTP id 14so3375018vea.29 for ; Fri, 22 Mar 2013 05:29:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=vs15BGcnc8DyZ3FLCKNE8t44L/2RZmYNZ0GlUQZtHF4=; b=GYkv3z6FRz+7F7EGneHlhpIXlgHp+WWlkOiL6Yv6NMErw1g1SoTcOBbHm/V0tkNUcm i88dOipWOX2r0hkdAUxgGz6Ao3sCVMTJPDka1VfQhScUgW4We0UTJulBM7Xn4IHhvL+w qb1MPrpwYIGOyl4L24O3n4phhhNb4mCcZ4T0S5zOFoDZV0KiAsR4D5vHcIfJvr0OAYom eGqmpbu2nAJRnLnZEWvObAGxDkqcQPMrZ7jvRYB78MNlpjlHW2WIBoywKtHyejDpC3uZ SrG6X1A+Q3BezArUwDze393Y9LHgwUvOjkroUMMd52jETLqdVsEIRwHnVI5s9T9gcD/K fGwQ== X-Received: by 10.58.207.163 with SMTP id lx3mr1883591vec.35.1363955386131; Fri, 22 Mar 2013 05:29:46 -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.58.233.198 with SMTP id ty6csp102075vec; Fri, 22 Mar 2013 05:29:45 -0700 (PDT) X-Received: by 10.180.19.39 with SMTP id b7mr11107655wie.15.1363955384954; Fri, 22 Mar 2013 05:29:44 -0700 (PDT) Received: from mail-wi0-x22f.google.com ([2a00:1450:400c:c05::22f]) by mx.google.com with ESMTPS id g6si855818wie.37.2013.03.22.05.29.44 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Mar 2013 05:29:44 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c05::22f is neither permitted nor denied by best guess record for domain of vincent.guittot@linaro.org) client-ip=2a00:1450:400c:c05::22f; Authentication-Results: mx.google.com; spf=neutral (google.com: 2a00:1450:400c:c05::22f 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-wi0-f175.google.com with SMTP id c10so2384372wiw.8 for ; Fri, 22 Mar 2013 05:29:44 -0700 (PDT) X-Received: by 10.194.220.70 with SMTP id pu6mr2747454wjc.27.1363955384561; Fri, 22 Mar 2013 05:29:44 -0700 (PDT) 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 f1sm3237642wib.0.2013.03.22.05.29.42 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Mar 2013 05:29:43 -0700 (PDT) From: Vincent Guittot To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-kernel@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, corbet@lwn.net, Vincent Guittot Subject: [RFC PATCH v3 5/6] sched: pack the idle load balance Date: Fri, 22 Mar 2013 13:25:54 +0100 Message-Id: <1363955155-18382-6-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1363955155-18382-1-git-send-email-vincent.guittot@linaro.org> References: <1363955155-18382-1-git-send-email-vincent.guittot@linaro.org> X-Gm-Message-State: ALoCoQmoseItF61LctTWPQY8Xn42ShIoCjU0LUToY7Xs7MQuQCWm2aaj9dZmlUMc7pcl6zS3Z67v 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 Reviewed-by: Morten Rasmussen --- kernel/sched/fair.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index b636199..52a7736 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5455,7 +5455,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;