Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp127755iog; Tue, 28 Jun 2022 18:09:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uKRQsqzCa6GGxS2hN2lB6qDxjlS43or6X9vQ201lAa9C/CExh3ioP/bjxsZzhSjAWOQZu0 X-Received: by 2002:a17:906:79ca:b0:705:111f:12dc with SMTP id m10-20020a17090679ca00b00705111f12dcmr822273ejo.602.1656464953458; Tue, 28 Jun 2022 18:09:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656464953; cv=none; d=google.com; s=arc-20160816; b=QyFHeWQ+0jDQ8B90Ugax1gG61niMyBgCZoQxTOdYqoNBAg29GtgM2LJdkGBomaMmI+ DhX1PsvPyDik7wB3iC2u0yATsoIr7J2/hm0J6P4YHv7qm6GwP54TxbG7gGW9dlOjE0C8 2dmK9IwsYxfVvAd8EHXwiZ02gEqGe94xtaaHnLki3UPfiT1hMhSVB+XhGEKjBHF7x0br VtJnM719zanNwM84fiaHhLOTEl5BmXVi1586plfE8iaKMD8Hn7flbFHB38tIvaa1JbA4 uwQdViyUddSBYHH/Kck/Fz4rnUQiloIDNZrugyOkquEMZiewIlIBd1aPy4hfbIvcotDf VzIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=sH5nJRSOe0Tkz3VwqFx1wGFGxKHppF/1AKWNqQwJXXQ=; b=m8OUTJBtaBNKJqtlXN7NQZSl0buajXT/OE5Gw08ZmMzaTZAO1Cr0AWuITKPCEGaK/a lvBh7SZe47Ot+FzDNYMNT9Kx+6LuYikVVXy7nRDxEh67TIUSVkDnY5F6PPovOOT7zp/n oz7DYXt15f5iYGscBOI6b3JMHIMB2pDvMlaHtgy4xV2gJbw6LU78fKE9DHNHvYEYDt61 BM8EjnGMLDk8+wmGzamkXf/5T7CnWFWzTqeH1MuztDQZ8CFyK7WoEx0HGV6UfzE/n88b Eu9mYGUQieiD5ROXIefZdqFmqeqXGGbHxgksniRiKxrHPy5lGFT2U/mzzh5x2ILicAUO 0cMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=RgCpcrqh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q15-20020a056402248f00b00437abfa4f6csi1495120eda.325.2022.06.28.18.08.24; Tue, 28 Jun 2022 18:09:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=RgCpcrqh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230034AbiF2AlV (ORCPT + 99 others); Tue, 28 Jun 2022 20:41:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbiF2AlU (ORCPT ); Tue, 28 Jun 2022 20:41:20 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E607E1117E for ; Tue, 28 Jun 2022 17:41:19 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id g39-20020a05600c4ca700b003a03ac7d540so7738744wmp.3 for ; Tue, 28 Jun 2022 17:41:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sH5nJRSOe0Tkz3VwqFx1wGFGxKHppF/1AKWNqQwJXXQ=; b=RgCpcrqhGtAhBQ2W2wz/07D8yS95WPCbLdxpPRfyKXiRmG63r+DQZ4BnFDpAzK632q RUyerbjqSxwwsvwMm0XuT8A+z02v9zSMGZB0HnHk8vw7yuCC3u5bUJEbgJ+Dc2LvB6RT HI2KwLCblfUabMbNYT+0wCHnefiiFi3m/l0RCFalOH6KtjFusu+3GJhO9P/T1wOBLwy5 pVkQyjYBOpFXP6K7Fg+tsq72i1jL9HLxpniSHYe1c/J2bvjlk0kXSgQ+Olpi2FxAPXVk DjoalwOJaAGCjXV//R5MhGuX1OFljc2/G6begpzkfDLoWmUKjtch8xh4Q56GWUIhz5Oo 8KUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sH5nJRSOe0Tkz3VwqFx1wGFGxKHppF/1AKWNqQwJXXQ=; b=a6SS0JI7+xBTPsgHJcodsdoF5xU/zhErR7Pl53AFRqScuYBRHkAFu3TOFFxgVpWDTQ /XGjFpiXSYDm96pRkMUnS6EQY7U+CKzuHdU+Ueb616OGcExy7vmBm79esoiUA3mG6WjW Y8q9zTF3iOCRz6UUosMsTs2EaNGruaRdipa8kceYNdRU3Zrxc0R6xHzvlEZHSmDNd14d 6gCJcTfqZn1GIPwesikvPFFVIR7/Obl298wMIBaaimdsnvKqNKWuFE0/J+Qhe/6748lF B0KpAvyObVZV9d3AcY5dC86KR1SAvtIR9MjsyENrV/ONttu/sASylqRqKGAfA27R5afT VC0w== X-Gm-Message-State: AJIora+rgQA2ydVzGStb1rzN4VRNwJ6yPBpCsscxlnBRFzY5aS5Nh6O4 CmL+YYGBuL6ufwDCQq+tSN6v3qaQTBg61L7ggo/FJg== X-Received: by 2002:a05:600c:3ace:b0:3a0:4ea4:5f77 with SMTP id d14-20020a05600c3ace00b003a04ea45f77mr587702wms.57.1656463278307; Tue, 28 Jun 2022 17:41:18 -0700 (PDT) MIME-Version: 1.0 References: <20220619120451.95251-1-wuyun.abel@bytedance.com> <20220619120451.95251-5-wuyun.abel@bytedance.com> <73ab0143-b518-c0b5-328e-c8f3ec7013ed@bytedance.com> In-Reply-To: <73ab0143-b518-c0b5-328e-c8f3ec7013ed@bytedance.com> From: Josh Don Date: Tue, 28 Jun 2022 17:41:06 -0700 Message-ID: Subject: Re: [PATCH v4 4/7] sched/fair: remove useless check in select_idle_core To: Abel Wu Cc: Peter Zijlstra , Mel Gorman , Vincent Guittot , Chen Yu , Tim Chen , K Prateek Nayak , "Gautham R . Shenoy" , linux-kernel Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 27, 2022 at 8:51 PM Abel Wu wrote: > > > On 6/28/22 7:42 AM, Josh Don Wrote: > > On Sun, Jun 19, 2022 at 5:05 AM Abel Wu wrote: > >> > >> The function only gets called when sds->has_idle_cores is true which can > >> be possible only when sched_smt_present is enabled. > >> > >> Signed-off-by: Abel Wu > >> --- > >> kernel/sched/fair.c | 3 --- > >> 1 file changed, 3 deletions(-) > >> > >> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > >> index aba1dad19574..1cc86e76e38e 100644 > >> --- a/kernel/sched/fair.c > >> +++ b/kernel/sched/fair.c > >> @@ -6256,9 +6256,6 @@ static int select_idle_core(struct task_struct *p, int core, struct cpumask *cpu > >> bool idle = true; > >> int cpu; > >> > >> - if (!static_branch_likely(&sched_smt_present)) > >> - return __select_idle_cpu(core, p); > >> - > > > > The static branch is basically free; although you're right that we > > currently don't take !smt_present branch direction here, it doesn't > > seem harmful to leave this check in case assumptions change about when > > we call select_idle_core(). > > I was thinking that it would be better to align with select_idle_smt > that the caller do the check if necessary. The difference there though is that select_idle_smt() is called directly under the sched_smt_active() check, whereas the select_idle_core() is a few nested function calls away (and relies on has_idle_core rather than sched_smt_active() directly). So it is a bit harder to codify this expectation. Since we're using a static_branch here, I don't see a strong reason to remove it. > > > >> for_each_cpu(cpu, cpu_smt_mask(core)) { > >> if (!available_idle_cpu(cpu)) { > >> idle = false; > >> -- > >> 2.31.1 > >>