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: 2489191 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id 782B6DF5B1 for ; Thu, 25 Apr 2013 17:29:38 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UVPx0-0001ct-IM; Thu, 25 Apr 2013 17:27:19 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UVPwE-0006tx-3j; Thu, 25 Apr 2013 17:26:30 +0000 Received: from mail-wi0-x233.google.com ([2a00:1450:400c:c05::233]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UVPuu-0006ie-5H for linux-arm-kernel@lists.infradead.org; Thu, 25 Apr 2013 17:25:18 +0000 Received: by mail-wi0-f179.google.com with SMTP id l13so3703106wie.0 for ; Thu, 25 Apr 2013 10:25:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=xkEwhxeyCWA0WCpSuruXF2/sukdyIqBkrxQ896XSTl8=; b=fc+2dnW1OeZNGc7VjdK0F/6yTmB/N4aeCeuggHVIvVuGKjzitUO/2G2HHGdL/f50R+ GToDxM1aM3+a8gqPgo9iiOwUWyXFZxNswvcBBqblDLx4c4mAL7RD5A8NXGair5Lr2RBi 2KMRwwOWAc/FmGjfqBFkseUpG4/j+aWw0F6KRuPJcwwcfpZCngljzgT6OqxO6PvSpyEw V7mtJ3A/uEecp+zZVVO0CWLuwbsq8lbT23DVRJEjVSuuek5y57do8AkERobr0ubfsTgd blnmSZrthFU3DdhaU+waGGVgHGGD0bbUnLBhC17H0e+0ioDvG/PWabnhstAi3HiviNWw 98mg== 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 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: ALoCoQk3ZQmBCf7G4ORr3Est0yBvhNmIoi3qJ+9fQ1FxwMl9hicn4bX5FXcp9vtrF2v/BEokLQ5f X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130425_132508_495821_01FE60AE X-CRM114-Status: GOOD ( 10.73 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: len.brown@intel.com, l.majewski@samsung.com, Vincent Guittot , corbet@lwn.net, amit.kucheria@linaro.org, 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.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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;