From nobody Mon Apr 6 14:11:59 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 8D833C54EE9 for ; Wed, 7 Sep 2022 11:21:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229704AbiIGLU7 (ORCPT ); Wed, 7 Sep 2022 07:20:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230004AbiIGLUt (ORCPT ); Wed, 7 Sep 2022 07:20:49 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCDB986B4B for ; Wed, 7 Sep 2022 04:20:37 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id iw17so7544405plb.0 for ; Wed, 07 Sep 2022 04:20:37 -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=aDniB8hJUxb/LoNqhQjiZRSUOVFgsRjJ2v0euL0XhpM=; b=B3KZs+fMUKHDSVYXzQBLMPYQfcMKpZy2VsEdFjggSkPKS6mg2CCks+Dt4+HJSB9jjo WnRiObuTk+sC3U4oZnwbSO6nEQKZlZFgOZaukkn4rS+GHjiyvJ2JFE9+MnavIMYZ58rf 3OtB8mWnNWmTog7QWeuNMoh21hIPwRpW4FAgkghVj+1iq2MDXZ7d5N2Vo03v24W3ekbj 5dac+ZvUxCkRVoZTDSpbJr8eBQaCESm5pBDP6ND695M68rVVsPnBT3Hdmt8JYE+vInS3 8q7z1O02qGn3AhPPl/XAVntVSc+ECNLOUuyDGE6HzHKgNgP0KQkvidXbyA3K8vFZiMpS cc+Q== 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=aDniB8hJUxb/LoNqhQjiZRSUOVFgsRjJ2v0euL0XhpM=; b=AlZP20fZyrC85Obkeg+1DVrQZ/hkIScnGiBIWg2+XHT6rk2nDm7ipsFkRm42vZfBWG lbt7md+pA4AmFEhD8s+H/QuZZRC393B4y5iCkHpskax2g5oqOtn6HlqPmbIJ0p0I3JSy SUgn6DEdlmmlVymHVdMoUVLBgn6sfuHgnqMgsUcTS+W4BircBWFrNsh78YwYtmOANVA5 SwgTFt+pIURsb8+/7T+urtnotw59a0swN0xA5+Z44lsnHmSk/x0Ej1mOxU0yQqzcqn4q k2Kz54F9bin+6oameU4Tz/1dCHoZD09TpzJExj6OL6IrxNtEVCPoBqdN4552/NUoA5mz Payg== X-Gm-Message-State: ACgBeo3VYtpjZz617uzbG6pu6FFxQA4aphBvmUbCa2//MEz71pvlYNhr HDtLMPgnnofzVZwOoNHfsbyHRQ== X-Google-Smtp-Source: AA6agR5C7KOVsKCuIqYGN5BWgkxBIsdBaOWkm0jQu98JwoSuyDpfaPmU/9X6BS3Lnd5CFo1KYYcStg== X-Received: by 2002:a17:903:22cf:b0:174:a5cd:31e0 with SMTP id y15-20020a17090322cf00b00174a5cd31e0mr3285343plg.23.1662549637312; Wed, 07 Sep 2022 04:20:37 -0700 (PDT) Received: from C02DV8HUMD6R.bytedance.net ([139.177.225.254]) by smtp.gmail.com with ESMTPSA id d12-20020a63f24c000000b0042ba0a822cbsm10334731pgk.8.2022.09.07.04.20.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Sep 2022 04:20:37 -0700 (PDT) From: Abel Wu To: Peter Zijlstra , Mel Gorman , Vincent Guittot Cc: Josh Don , Chen Yu , Yicong Yang , linux-kernel@vger.kernel.org, Abel Wu Subject: [PATCH v4 5/5] sched/fair: Cleanup for SIS_PROP Date: Wed, 7 Sep 2022 19:20:00 +0800 Message-Id: <20220907112000.1854-6-wuyun.abel@bytedance.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220907112000.1854-1-wuyun.abel@bytedance.com> References: <20220907112000.1854-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 sched-domain of this cpu is only used for some heuristics when SIS_PROP is enabled, and it should be irrelevant whether the local sd_llc is valid or not, since all we care about is target sd_llc if !SIS_PROP. Access the local domain only when there is a need. Signed-off-by: Abel Wu Acked-by: Mel Gorman --- kernel/sched/fair.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 23b020c3d3a0..7bad641faef9 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6396,19 +6396,19 @@ static int select_idle_cpu(struct task_struct *p, s= truct sched_domain *sd, bool struct sched_domain_shared *sd_share; struct rq *this_rq =3D this_rq(); int this =3D smp_processor_id(); - struct sched_domain *this_sd; + struct sched_domain *this_sd =3D NULL; u64 time =3D 0; =20 - this_sd =3D rcu_dereference(*this_cpu_ptr(&sd_llc)); - if (!this_sd) - return -1; - cpumask_and(cpus, sched_domain_span(sd), p->cpus_ptr); =20 if (sched_feat(SIS_PROP) && !has_idle_core) { u64 avg_cost, avg_idle, span_avg; unsigned long now =3D jiffies; =20 + this_sd =3D rcu_dereference(*this_cpu_ptr(&sd_llc)); + if (!this_sd) + return -1; + /* * If we're busy, the assumption that the last idle period * predicts the future is flawed; age away the remaining @@ -6462,7 +6462,7 @@ static int select_idle_cpu(struct task_struct *p, str= uct sched_domain *sd, bool if (has_idle_core) set_idle_cores(target, false); =20 - if (sched_feat(SIS_PROP) && !has_idle_core) { + if (sched_feat(SIS_PROP) && this_sd && !has_idle_core) { time =3D cpu_clock(this) - time; =20 /* --=20 2.37.3