Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1901730pxb; Sun, 31 Oct 2021 03:20:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzh39v9ULsxSfqwico5WMifBQYqITB9UBsj3PmL7SOTlh5/oTgVUY/MSQWZvZgVUkd9BrW/ X-Received: by 2002:a05:6638:16d6:: with SMTP id g22mr16414281jat.19.1635675649976; Sun, 31 Oct 2021 03:20:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635675649; cv=none; d=google.com; s=arc-20160816; b=moagaJo85dDjLYocq08UNLFSA4H7vF89zmURG/xC8g09Bef3nUylQbJ2hAv+hJZE8z vtZtjLWZ4OEUWGeg0xS1GpKmivShyg6kiLrkEZmva3Ab+7wvMfhhn/niuiTZpdn+8acO +sRxwT7l8AvBaWVIVNwifrr3vOhb14RJfHdkNWTH+WMYHHI0pmae1f45kyvqzflo+abd aoGJKIzEe3A0ssYS6lLXvZycKd1syd7Lrfw6Bp9exj/wMc12OxgXtta+zQuPF2RSbwAh 5sy32tAQ6TnjkJa/801jp1PUUgUCtBIzqlV10ZJwshtPtud35t8aqEKHPzQdzuptvCBh /v8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=3/aqh/hDBvKlRDYUag7BPNoidPusmkWpvk8Q5e4Ty+k=; b=WohXIkHV8r/LcAipcogzF5383d+QWZcJLBDIvtD7yPURumWW/9Xx4LFcvVe7Hsn3tI RoBiOydVfPNdzZFctKe/qd+E4GMDDt72cTZ5UcmgUiaa7KMvl/ount8PWMR8zxckjU4f T2u4lDmdvv1wQCzFYChGa8Cm1xCJZ1nIKD+szgUsJgzKgX1/MvLfX39b4VWf/RI8GDZd gZrlifxeZL6XqYz7r1fIEnCkWQulmcYW91PBddpQLRosS/OUCxM9Ila887I/GvrthjGP Vm1aSO5t9FK/ZTmi3hYgxtbm1N02P52R0ibKEXf8M+embQ5EgMX2sdEFrUR9Eq6ys5c1 +59w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=BcOE4Ji5; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m2si18160889iov.47.2021.10.31.03.20.36; Sun, 31 Oct 2021 03:20:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=BcOE4Ji5; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231499AbhJaKTE (ORCPT + 99 others); Sun, 31 Oct 2021 06:19:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230309AbhJaKTA (ORCPT ); Sun, 31 Oct 2021 06:19:00 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A106C061570; Sun, 31 Oct 2021 03:16:28 -0700 (PDT) Date: Sun, 31 Oct 2021 10:16:26 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1635675387; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3/aqh/hDBvKlRDYUag7BPNoidPusmkWpvk8Q5e4Ty+k=; b=BcOE4Ji567zelabrZ+PuRygx/GPgbUOy+c4tpDwu0yuRDYv4LOLLGkPJZYvPKXK3RG5lbM tm0waMOdps0QfXirzHsQHqPXUtCI0RfdV2Ybu/83JHUgfmHCCpgk4QLbAjfQZxjdL3jcy5 FN6ZcBv/2PnJUqjEuq/sh/VrAMKQ5H/XKnyeuEaHspQX+Ok+aiL3IyujWW9wwZB9wTgqQ1 unS8/C5c/FiHHQM950js1clH68Ro7WrLU3s09j3O2lA89sGr1rDss5CKF93Jj9SULN2nK1 n6Ivu3hqReN6uKYmh1NzjNS5fQ6OeSEr89QOmpDUW9gI4vRKEZmqqqMMBlss+g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1635675387; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3/aqh/hDBvKlRDYUag7BPNoidPusmkWpvk8Q5e4Ty+k=; b=Bbrn25AvaFL7m7nOcWORsuDBtoSlzj3HHqNWTVpEIS0y4DiA9Ni1ZF8Hl5tRG6fkoZ/a7K P1N5X/h0vJDCTQBA== From: "tip-bot2 for Vincent Guittot" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/fair: Skip update_blocked_averages if we are defering load balance Cc: Vincent Guittot , Tim Chen , "Peter Zijlstra (Intel)" , Dietmar Eggemann , Mel Gorman , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20211019123537.17146-3-vincent.guittot@linaro.org> References: <20211019123537.17146-3-vincent.guittot@linaro.org> MIME-Version: 1.0 Message-ID: <163567538617.626.6566030882638028616.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/core branch of tip: Commit-ID: 9d783c8dd112ad4b619e74e4bf57d2be0b400693 Gitweb: https://git.kernel.org/tip/9d783c8dd112ad4b619e74e4bf57d2be0b400693 Author: Vincent Guittot AuthorDate: Tue, 19 Oct 2021 14:35:34 +02:00 Committer: Peter Zijlstra CommitterDate: Sun, 31 Oct 2021 11:11:37 +01:00 sched/fair: Skip update_blocked_averages if we are defering load balance In newidle_balance(), the scheduler skips load balance to the new idle cpu when the 1st sd of this_rq is: this_rq->avg_idle < sd->max_newidle_lb_cost Doing a costly call to update_blocked_averages() will not be useful and simply adds overhead when this condition is true. Check the condition early in newidle_balance() to skip update_blocked_averages() when possible. Signed-off-by: Vincent Guittot Signed-off-by: Tim Chen Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Dietmar Eggemann Acked-by: Mel Gorman Link: https://lore.kernel.org/r/20211019123537.17146-3-vincent.guittot@linaro.org --- kernel/sched/fair.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index c014567..c4c3686 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -10873,17 +10873,20 @@ static int newidle_balance(struct rq *this_rq, struct rq_flags *rf) */ rq_unpin_lock(this_rq, rf); + rcu_read_lock(); + sd = rcu_dereference_check_sched_domain(this_rq->sd); + if (this_rq->avg_idle < sysctl_sched_migration_cost || - !READ_ONCE(this_rq->rd->overload)) { + !READ_ONCE(this_rq->rd->overload) || + (sd && this_rq->avg_idle < sd->max_newidle_lb_cost)) { - rcu_read_lock(); - sd = rcu_dereference_check_sched_domain(this_rq->sd); if (sd) update_next_balance(sd, &next_balance); rcu_read_unlock(); goto out; } + rcu_read_unlock(); raw_spin_rq_unlock(this_rq);