From patchwork Thu Apr 25 17:23:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 16399 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f200.google.com (mail-vc0-f200.google.com [209.85.220.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F3FD12395D for ; Thu, 25 Apr 2013 17:25:51 +0000 (UTC) Received: by mail-vc0-f200.google.com with SMTP id gf12sf937409vcb.3 for ; Thu, 25 Apr 2013 10:24:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=0WXnKnDbMc5coMvMX/LiNF1nwewlIIICHD7Wq2xOszQ=; b=NbaZ2l5C+DXAH0lfTWyAzBj1QOcv4AK4IaGLp1vugRxBzUKQm/p4VQlw+XyU8WD5jl Pm+rLXhZAX9NejiGmNlfp0qHun+DwL+vs31uvocyWrWdStEOMH9/JFa8Bd0k8P2C5/wO GCU42rRHXtkK8N7XZt5d5D4IpoRMS504NvcaAxkFbBjNbtZWNHWXlkuM2xd8chqOIxKl H9f3xyUtFDTI7+6ziq1/tt5hKNzGlbvo+3pXhdV6McxsuW/NVUL8zcBh07qB6JLQIsF8 LVP9xXOqUNGdcBx5C2yhLAlsYdBbD/eOORSK573x04zhy6+yQ0CuzxwG+esfhiQIqlLo CJOg== X-Received: by 10.236.19.198 with SMTP id n46mr18771869yhn.8.1366910698253; Thu, 25 Apr 2013 10:24:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.0.236 with SMTP id 12ls1494170qeh.89.gmail; Thu, 25 Apr 2013 10:24:58 -0700 (PDT) X-Received: by 10.52.0.147 with SMTP id 19mr23118662vde.97.1366910698083; Thu, 25 Apr 2013 10:24:58 -0700 (PDT) Received: from mail-vb0-x233.google.com (mail-vb0-x233.google.com [2607:f8b0:400c:c02::233]) by mx.google.com with ESMTPS id ij9si3699683vdb.4.2013.04.25.10.24.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Apr 2013 10:24:58 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::233 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::233; Received: by mail-vb0-f51.google.com with SMTP id x19so2810852vbf.24 for ; Thu, 25 Apr 2013 10:24:58 -0700 (PDT) X-Received: by 10.52.166.103 with SMTP id zf7mr23509744vdb.94.1366910697994; Thu, 25 Apr 2013 10:24:57 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp32654veb; Thu, 25 Apr 2013 10:24:57 -0700 (PDT) X-Received: by 10.180.198.49 with SMTP id iz17mr11561596wic.19.1366910697025; Thu, 25 Apr 2013 10:24:57 -0700 (PDT) Received: from mail-wi0-x234.google.com (mail-wi0-x234.google.com [2a00:1450:400c:c05::234]) by mx.google.com with ESMTPS id bz12si9559717wib.19.2013.04.25.10.24.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Apr 2013 10:24:57 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c05::234 is neither permitted nor denied by best guess record for domain of vincent.guittot@linaro.org) client-ip=2a00:1450:400c:c05::234; Received: by mail-wi0-f180.google.com with SMTP id h11so3701591wiv.1 for ; Thu, 25 Apr 2013 10:24:56 -0700 (PDT) X-Received: by 10.194.63.109 with SMTP id f13mr77194630wjs.11.1366910696639; Thu, 25 Apr 2013 10:24:56 -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 ESMTPSA id q13sm12311485wie.8.2013.04.25.10.24.54 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Apr 2013 10:24:56 -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, alex.shi@intel.com, preeti@linux.vnet.ibm.com Cc: paulmck@linux.vnet.ibm.com, tglx@linutronix.de, len.brown@intel.com, arjan@linux.intel.com, amit.kucheria@linaro.org, corbet@lwn.net, l.majewski@samsung.com, Vincent Guittot Subject: [PATCH 04/14] sched: pack the idle load balance Date: Thu, 25 Apr 2013 19:23:20 +0200 Message-Id: <1366910611-20048-5-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1366910611-20048-1-git-send-email-vincent.guittot@linaro.org> References: <1366910611-20048-1-git-send-email-vincent.guittot@linaro.org> X-Gm-Message-State: ALoCoQnyeIp3D2Bxj5i9eyfwSaLu4E2uq4bJ1EfpvelR0yZVZYi6luPi6peY+Cu0AsHyPqgyYuTq X-Original-Sender: vincent.guittot@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::233 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 6adc57c..a985c98 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5469,7 +5469,26 @@ 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;