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 A55E8C4361A for ; Wed, 3 Mar 2021 14:51:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5D2EB64E02 for ; Wed, 3 Mar 2021 14:51:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359763AbhCCOuv (ORCPT ); Wed, 3 Mar 2021 09:50:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843038AbhCCKYr (ORCPT ); Wed, 3 Mar 2021 05:24:47 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C96BC08EC66; Wed, 3 Mar 2021 01:49:41 -0800 (PST) Date: Wed, 03 Mar 2021 09:49:36 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1614764977; 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=Q5MEh5+BGenUUyK/QrA5gHPrNEb8FI+SOWRvaZ1nfVk=; b=ebdqO8avVzWZu3nNs4Um5UU/5cJpoiwvTGEUxMhTEFyYToYx68Pe92vM/CNM2aOBO70JSo 9ozl6rZR7n6bJFHOCgGb9Nu5mwon4YQulSH0ItMjBJPB27Cfs1qe8zYdzCkOpkivfpbxFe zfLjudrXbjtnhJsCFlICS572FBZAlmD4dg+fbe1pRU6YRR3xlSlt1kmOh+0GbQmbwDR4SK CjmwPlKkExUMFzLAQfsBywSwnRuM5kUvrB1L3E6bT87kpaRndpw4HS6/HdLSdXRnh8itKV zqxyObXUZoJektJtJEqtIWWqwtMGhpqhfI/8Bzdz7ssfNBde3AfAWnX37BgEyQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1614764977; 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=Q5MEh5+BGenUUyK/QrA5gHPrNEb8FI+SOWRvaZ1nfVk=; b=vvcXVb8/jDZewlk2W/WzXXABJ7o4jGFdKIJnfHOwN3SKL6VLWB0w27zDOG3SwMBom3xdyz qQJ5+6uYMAnFqhCg== 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: Reduce the window for duplicated update Cc: Vincent Guittot , "Peter Zijlstra (Intel)" , Valentin Schneider , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20210224133007.28644-8-vincent.guittot@linaro.org> References: <20210224133007.28644-8-vincent.guittot@linaro.org> MIME-Version: 1.0 Message-ID: <161476497664.20312.7873446370756765765.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: 780eec5b50930b34e2f096b4dce5368d90497b55 Gitweb: https://git.kernel.org/tip/780eec5b50930b34e2f096b4dce5368d90497b55 Author: Vincent Guittot AuthorDate: Wed, 24 Feb 2021 14:30:07 +01:00 Committer: Peter Zijlstra CommitterDate: Wed, 03 Mar 2021 10:32:59 +01:00 sched/fair: Reduce the window for duplicated update Start to update last_blocked_load_update_tick to reduce the possibility of another cpu starting the update one more time Signed-off-by: Vincent Guittot Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Valentin Schneider Link: https://lkml.kernel.org/r/20210224133007.28644-8-vincent.guittot@linaro.org --- kernel/sched/fair.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index e87e1b3..f1b55f9 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7852,16 +7852,20 @@ static inline bool others_have_blocked(struct rq *rq) return false; } -static inline void update_blocked_load_status(struct rq *rq, bool has_blocked) +static inline void update_blocked_load_tick(struct rq *rq) { - rq->last_blocked_load_update_tick = jiffies; + WRITE_ONCE(rq->last_blocked_load_update_tick, jiffies); +} +static inline void update_blocked_load_status(struct rq *rq, bool has_blocked) +{ if (!has_blocked) rq->has_blocked_load = 0; } #else static inline bool cfs_rq_has_blocked(struct cfs_rq *cfs_rq) { return false; } static inline bool others_have_blocked(struct rq *rq) { return false; } +static inline void update_blocked_load_tick(struct rq *rq) {} static inline void update_blocked_load_status(struct rq *rq, bool has_blocked) {} #endif @@ -8022,6 +8026,7 @@ static void update_blocked_averages(int cpu) struct rq_flags rf; rq_lock_irqsave(rq, &rf); + update_blocked_load_tick(rq); update_rq_clock(rq); decayed |= __update_blocked_others(rq, &done); @@ -8363,7 +8368,7 @@ static bool update_nohz_stats(struct rq *rq) if (!cpumask_test_cpu(cpu, nohz.idle_cpus_mask)) return false; - if (!time_after(jiffies, rq->last_blocked_load_update_tick)) + if (!time_after(jiffies, READ_ONCE(rq->last_blocked_load_update_tick))) return true; update_blocked_averages(cpu);