Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1035122pxb; Thu, 4 Mar 2021 01:16:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJwCyzQjBX4BSl3yizT3mVcMhPf9ujbLkWrBWF07zSUJCbYjBI0QZyzklmWJ8CcdI8L/DsZt X-Received: by 2002:a17:907:10ce:: with SMTP id rv14mr3273313ejb.56.1614849362372; Thu, 04 Mar 2021 01:16:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614849362; cv=none; d=google.com; s=arc-20160816; b=FJxgNLPwzPpLrWPKVjU5pghZbWE1egxJGh811e6tSEkzWQFwe22+cpK86J9/++34Mw SinCjKTHJ3iFZpGUWwJGa5L7/NIns1hxsjd6IR293hNiRD9D+YkB7uTaSw5dwz9Z5K1X zTqgA/n4VvJ5wNc+yGDusaZzofN7suVugie+zTm8CDDJcJw3hpxa4/7JDf1uphnzRd5t erk4GERuNZMH+uvKNGwjs/64cTh2JG0iNv8+6wIwIeL9COLNKhwQ1C0VA4dnmELRcBRi ekZN2eGXEg6W6dFE4eG5kMv6EffCTMyfYGTEpWD0+244Rm/5sIuLOK5uUpW7dSsCabTe hitA== 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=ch8o6XbDa6CK1VvCA+XQ2OhcGyrfZWVFh7nJuLHRs3o=; b=UKoSkj309NoQwx8ItET/6M3h1RcflqFZ0jRdW2vBq6HYT2vaouWK3HkFce8iflh2PR u4fp6l5OBMNqsWxAfNR+3JwEGk2GPu2V9bJ3wZmH5c/qi2PlpFnRQ5jTswFiBiy3I3h7 C6LfSFYY1lKL3iScGhMhOtmE7jZdzm7WYVjcKuWbe/n4eisFhBAV/7eYh59Ub7UNWYjy yp027V/iNoBAKrLSl9XXe6ZHE3WYYc5lSe2YFiOiKqmAqf1EnUUr5hCWXi2Hhf93bj5u hEX81NkyPRbYlVhe/plyRTsVbllya0GP6b4pn7FfAJz0Z3RGsVGdk9JQenWC0YBfAjRV F6hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Tgay1+jf; 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 a12si15123922ejy.363.2021.03.04.01.15.39; Thu, 04 Mar 2021 01:16:02 -0800 (PST) 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=Tgay1+jf; 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 S1382060AbhCCObC (ORCPT + 99 others); Wed, 3 Mar 2021 09:31:02 -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));