From nobody Mon Apr 6 10:10:23 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B714ECAAA1 for ; Fri, 9 Sep 2022 05:53:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230287AbiIIFxt (ORCPT ); Fri, 9 Sep 2022 01:53:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229720AbiIIFxe (ORCPT ); Fri, 9 Sep 2022 01:53:34 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAF3DC00E3 for ; Thu, 8 Sep 2022 22:53:31 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id pj10so570918pjb.2 for ; Thu, 08 Sep 2022 22:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=fNnn9wLK8Hw5NIwUy4nGEsew1EpO470MKUS9ViwkYPA=; b=N0iuRf8Tjp2U1euObd/YNC0SPejhZ0Idhojtv157DwpOMO7zpKPXUeBwrzlh1YYcVU KOzGhtqbNMiAYfNjOADqG5MvRpyxpgydXN3dFerF3Mzf/PCUFNFM3cf0S/7nprAEOEgB 8Xewe9KluYQFn6HWd2kKf2g6AdaXag+myWQwTDSaaWNK1+XAl6rpGD1avmUFGtgBTztX bnFXCG5jKQck+bOkSAJesNmgrmY03Jlds4qI/R0gDgiGDYMeQZryiAIvsBn8RtN1wrzs 7kF/AQ8dk6DD601+Dib9J1QSWiRT/C1Zd/egX2bUohIJWYAQmm7xAcR8wUUxLsYYPHNt qC4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=fNnn9wLK8Hw5NIwUy4nGEsew1EpO470MKUS9ViwkYPA=; b=PSYv+Iokz05dY6GHES3GFvj2NI3urSHUStayUvfC48Po1R7LvIP6MdDB0UdcvMhim4 fG1mBStmVaeu3nWys4zOKhRG7g9/9wiSvQ2YO2ki5epFYRa5/oIGNa9pJ7+0hEWY/6aF kIuNcsLD7QVcQ7QDFNDdUMG083+9WR4Ff8AYqtWpnD4J9BnpLb3Jp/y9EnnB2A4job2a 3gIvaHDvktGZgfePfbrv/fnNXQlC8zdmrdHkMzvREhJ3k0IXyOJW7yZNumTbTjfea7R1 FGxB3M7eVULcuTd7Atrk+3IwepUcddJmX8Y8GGSLOpFxs5rO6ER23RxiLJtPFtuA9xlK o0VA== X-Gm-Message-State: ACgBeo0YGMI1mz673vEIOTIipjmb5MSC6YlaH6ObzH3K84HgfbHtab1Q 10rh1ac5OHk7MDLSKTaAqICqyQ== X-Google-Smtp-Source: AA6agR7o05QuyuiUecgvMWqqSXv+iDtcuBax2JBvTYVEVJeZomRC9ggsMz4Xw9Ao7hWisu/Abd1nOQ== X-Received: by 2002:a17:902:ea0c:b0:176:75a2:625d with SMTP id s12-20020a170902ea0c00b0017675a2625dmr12288617plg.21.1662702810956; Thu, 08 Sep 2022 22:53:30 -0700 (PDT) Received: from localhost.localdomain ([139.177.225.249]) by smtp.gmail.com with ESMTPSA id y66-20020a636445000000b00421841943dfsm464380pgb.12.2022.09.08.22.53.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Sep 2022 22:53:30 -0700 (PDT) From: Abel Wu To: Peter Zijlstra , Mel Gorman , Vincent Guittot Cc: Josh Don , Chen Yu , Tim Chen , K Prateek Nayak , "Gautham R . Shenoy" , linux-kernel@vger.kernel.org, Abel Wu Subject: [PATCH v5 3/5] sched/fair: Skip core update if task pending Date: Fri, 9 Sep 2022 13:53:02 +0800 Message-Id: <20220909055304.25171-4-wuyun.abel@bytedance.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220909055304.25171-1-wuyun.abel@bytedance.com> References: <20220909055304.25171-1-wuyun.abel@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The function __update_idle_core() considers this cpu is idle so only checks its siblings to decide whether the resident core is idle or not and update has_idle_cores hint if necessary. But the problem is that this cpu might not be idle at that moment any more, resulting in the hint being misleading. It's not proper to make this check everywhere in the idle path, but checking just before core updating can make the has_idle_core hint more reliable with negligible cost. Signed-off-by: Abel Wu --- kernel/sched/fair.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 7abe188a1533..fad289530e07 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6294,6 +6294,9 @@ void __update_idle_core(struct rq *rq) int core =3D cpu_of(rq); int cpu; =20 + if (rq->ttwu_pending) + return; + rcu_read_lock(); if (test_idle_cores(core, true)) goto unlock; --=20 2.37.3