From patchwork Thu Apr 25 17:23:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 16403 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f72.google.com (mail-qe0-f72.google.com [209.85.128.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3D3BB2395D for ; Thu, 25 Apr 2013 17:26:01 +0000 (UTC) Received: by mail-qe0-f72.google.com with SMTP id 9sf1928065qea.11 for ; Thu, 25 Apr 2013 10:25:07 -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=xkEwhxeyCWA0WCpSuruXF2/sukdyIqBkrxQ896XSTl8=; b=LTiUYg8wCImyemql/YyfFsPShcQWfmMBKqrXcwJl6AsKrSvfuIF8J91eM+AAwbI4tO xK88KwNTrI0vZ9XNKqEtHWh4M/QEUVH/jHW3JqP3EwbuU+hNnLG735Ix4agWjPyaIBJK UN/BkWHh5pn0TrGEP0aFK89GRRfQ2UkXCE6JrkDFVI7r3q1ZuJC3C6xmMSo7E+t9mtkU /Tnl/SbvAPoFGsnDgcRgh4YzD60lbfaqN9akYwv57JAUbIqgYLL5mhpFQPzlmjUhQhya rvf5IqEvmDoDGprasnv35KN8qYx9+zVgFvnC5iYzkjbP880Kt1dUiXdTYYtIv0WEeJ2K gxGA== X-Received: by 10.224.217.195 with SMTP id hn3mr27734844qab.5.1366910707549; Thu, 25 Apr 2013 10:25:07 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.5.10 with SMTP id o10ls1458230qeo.69.gmail; Thu, 25 Apr 2013 10:25:07 -0700 (PDT) X-Received: by 10.220.147.79 with SMTP id k15mr13386417vcv.38.1366910707307; Thu, 25 Apr 2013 10:25:07 -0700 (PDT) Received: from mail-vb0-x22e.google.com (mail-vb0-x22e.google.com [2607:f8b0:400c:c02::22e]) by mx.google.com with ESMTPS id se7si3676217vec.18.2013.04.25.10.25.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Apr 2013 10:25:07 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::22e 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::22e; Received: by mail-vb0-f46.google.com with SMTP id 11so2882791vbe.33 for ; Thu, 25 Apr 2013 10:25:07 -0700 (PDT) X-Received: by 10.221.0.199 with SMTP id nn7mr27747608vcb.14.1366910707214; Thu, 25 Apr 2013 10:25:07 -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 nf2csp32666veb; Thu, 25 Apr 2013 10:25:06 -0700 (PDT) X-Received: by 10.194.176.195 with SMTP id ck3mr55897601wjc.5.1366910706345; Thu, 25 Apr 2013 10:25:06 -0700 (PDT) Received: from mail-wi0-x232.google.com (mail-wi0-x232.google.com [2a00:1450:400c:c05::232]) by mx.google.com with ESMTPS id lv6si2742005wjb.70.2013.04.25.10.25.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Apr 2013 10:25:06 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c05::232 is neither permitted nor denied by best guess record for domain of vincent.guittot@linaro.org) client-ip=2a00:1450:400c:c05::232; Received: by mail-wi0-f178.google.com with SMTP id hm14so3701200wib.11 for ; Thu, 25 Apr 2013 10:25:06 -0700 (PDT) X-Received: by 10.180.90.70 with SMTP id bu6mr66796963wib.34.1366910705933; Thu, 25 Apr 2013 10:25:05 -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.25.03 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Apr 2013 10:25:05 -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 08/14] sched: trig ILB on an idle buddy Date: Thu, 25 Apr 2013 19:23:24 +0200 Message-Id: <1366910611-20048-9-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: ALoCoQk+Lh35SEM1iYs3DJGV+4ep1Ow1pbO+yaTuwDCrk5uloDf5aBLAZOR3nZr34CnKJ7n04PYD X-Original-Sender: vincent.guittot@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::22e 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: , If the buddy CPU is not full and currently idle, we trigger an Idle Load Balance to give it the opportunity to pull more tasks. Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 874f330..954adfd 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5776,6 +5776,26 @@ end: clear_bit(NOHZ_BALANCE_KICK, nohz_flags(this_cpu)); } +static int check_nohz_buddy(int cpu) +{ + int buddy = per_cpu(sd_pack_buddy, cpu); + + if (sysctl_sched_packing_mode != SCHED_PACKING_FULL) + return false; + + /* No pack buddy for this CPU */ + if (buddy == -1) + return false; + + if (is_buddy_full(buddy)) + return false; + + if (cpumask_test_cpu(buddy, nohz.idle_cpus_mask)) + return true; + + return false; +} + /* * Current heuristic for kicking the idle load balancer in the presence * of an idle cpu is the system. @@ -5813,6 +5833,10 @@ static inline int nohz_kick_needed(struct rq *rq, int cpu) if (rq->nr_running >= 2) goto need_kick; + /* the buddy is idle and not busy so we can pack */ + if (check_nohz_buddy(cpu)) + goto need_kick; + rcu_read_lock(); for_each_domain(cpu, sd) { struct sched_group *sg = sd->groups;