From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35635C433DB for ; Wed, 3 Mar 2021 14:33:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 085A564EE4 for ; Wed, 3 Mar 2021 14:33:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383306AbhCCObF (ORCPT ); Wed, 3 Mar 2021 09:31:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1842970AbhCCKXL (ORCPT ); Wed, 3 Mar 2021 05:23:11 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D889BC08EC35; Wed, 3 Mar 2021 01:49:39 -0800 (PST) Date: Wed, 03 Mar 2021 09:49:37 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1614764978; 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=ch8o6XbDa6CK1VvCA+XQ2OhcGyrfZWVFh7nJuLHRs3o=; b=Tgay1+jfd2cjT5aAV5gCvOc2Ie8muVN3/rktva9ZTpqze5HR4hxBCb/0oWdsq7g+ZpaTMb /xv0mzHrCBE/2VDyORDeXbaJCIIpDHfCCyPeqhv6OK0ukztYncJ3wcE+6QDSzkA5Jv8SLv yP7gf6Jr9odJNNOIEF63GDcrcZgLs2BoukVELwxSjYutXLZ3g20XSi4vv7Tpv8G1PAN6Pe tM5is4UcC3Ko7ShsKqw7y22eWY/7vUjQwCafVQ3Z6BFunYMBq58G6zT9Qxv9/DjUGxoKv2 OdWcutpW+MZVUOPdzaB70hjqvWSsyxewjjXTrobgtrnuI3DL8JxPgFZWAVGJgQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1614764978; 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=ch8o6XbDa6CK1VvCA+XQ2OhcGyrfZWVFh7nJuLHRs3o=; b=PWwKsQ67J+UiRrT1FHtgtgZdntr+0kpK4QAiJfKNKuVsbLCWAZlH66XzZ4kLCEoos/O7KL WHGxlbxjfd5vJaDw== 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: Merge for each idle cpu loop of ILB Cc: Vincent Guittot , "Peter Zijlstra (Intel)" , Valentin Schneider , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20210224133007.28644-5-vincent.guittot@linaro.org> References: <20210224133007.28644-5-vincent.guittot@linaro.org> MIME-Version: 1.0 Message-ID: <161476497787.20312.14014429392968052029.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: 2aa7f2f6d1e4308b81bef079091561445b9cb949 Gitweb: https://git.kernel.org/tip/2aa7f2f6d1e4308b81bef079091561445b9cb949 Author: Vincent Guittot AuthorDate: Wed, 24 Feb 2021 14:30:04 +01:00 Committer: Peter Zijlstra CommitterDate: Wed, 03 Mar 2021 10:32:59 +01:00 sched/fair: Merge for each idle cpu loop of ILB Remove the specific case for handling this_cpu outside for_each_cpu() loop when running ILB. Instead we use for_each_cpu_wrap() and start with the next cpu after this_cpu so we will continue to finish with this_cpu. update_nohz_stats() is now used for this_cpu too and will prevents unnecessary update. We don't need a special case for handling the update of nohz.next_balance for this_cpu anymore because it is now handled by the loop like others. Signed-off-by: Vincent Guittot Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Valentin Schneider Link: https://lkml.kernel.org/r/20210224133007.28644-5-vincent.guittot@linaro.org --- kernel/sched/fair.c | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 1b91030..3c00918 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -10043,22 +10043,9 @@ out: * When the cpu is attached to null domain for ex, it will not be * updated. */ - if (likely(update_next_balance)) { + if (likely(update_next_balance)) rq->next_balance = next_balance; -#ifdef CONFIG_NO_HZ_COMMON - /* - * If this CPU has been elected to perform the nohz idle - * balance. Other idle CPUs have already rebalanced with - * nohz_idle_balance() and nohz.next_balance has been - * updated accordingly. This CPU is now running the idle load - * balance for itself and we need to update the - * nohz.next_balance accordingly. - */ - if ((idle == CPU_IDLE) && time_after(nohz.next_balance, rq->next_balance)) - nohz.next_balance = rq->next_balance; -#endif - } } static inline int on_null_domain(struct rq *rq) @@ -10385,8 +10372,12 @@ static void _nohz_idle_balance(struct rq *this_rq, unsigned int flags, */ smp_mb(); - for_each_cpu(balance_cpu, nohz.idle_cpus_mask) { - if (balance_cpu == this_cpu || !idle_cpu(balance_cpu)) + /* + * Start with the next CPU after this_cpu so we will end with this_cpu and let a + * chance for other idle cpu to pull load. + */ + for_each_cpu_wrap(balance_cpu, nohz.idle_cpus_mask, this_cpu+1) { + if (!idle_cpu(balance_cpu)) continue; /* @@ -10432,15 +10423,6 @@ static void _nohz_idle_balance(struct rq *this_rq, unsigned int flags, if (likely(update_next_balance)) nohz.next_balance = next_balance; - /* Newly idle CPU doesn't need an update */ - if (idle != CPU_NEWLY_IDLE) { - update_blocked_averages(this_cpu); - has_blocked_load |= this_rq->has_blocked_load; - } - - if (flags & NOHZ_BALANCE_KICK) - rebalance_domains(this_rq, CPU_IDLE); - WRITE_ONCE(nohz.next_blocked, now + msecs_to_jiffies(LOAD_AVG_PERIOD));