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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EEF8DC43334 for ; Fri, 10 Jun 2022 06:55:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:CC:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=pBtTj4Jc3z0NDJcOw147fPoqGtQTK12sNRchNKqwtA4=; b=1ILc+WJKOICXvqsS4K0vRi50gP Ox6jLcK3hI/zdxnusIzrl18lHswh995GgFqbOVAGwYd83wfE4LhgNhDoPXB2VvE1f5kcdFDv7gPtT MPX2bSl+2PD2LhXF4RgviVEO4g9x0GpLa6t8jrX59DDcZ9lJT1Knqy50xCzxjgGJNN9DKrbBT1cld OT2R7Xes1udB5l05/59U5b1m6fhPKqb0nICmyHAYgSIErUza7XSl15ht8ZwkYhYrweIktzdFy25LZ eqtS/BHohfbBeJbmlbx65xsZtjOJPENIBjLJK8E6PSqX/fzEpeU9qp43plJbKQ6aOMMeOurC3aIV3 eOMFoIhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nzYXJ-006He2-As; Fri, 10 Jun 2022 06:54:25 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nzYXB-006Hbg-HK for linux-arm-kernel@lists.infradead.org; Fri, 10 Jun 2022 06:54:22 +0000 Received: from canpemm500009.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LKBTv5cxkzgYg9; Fri, 10 Jun 2022 14:52:19 +0800 (CST) Received: from [10.67.102.169] (10.67.102.169) by canpemm500009.china.huawei.com (7.192.105.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 10 Jun 2022 14:54:10 +0800 CC: , , , , , , , , , <21cnbao@gmail.com>, , , , Subject: Re: [PATCH v4 1/2] sched: Add per_cpu cluster domain info and cpus_share_resources API To: Tim Chen , Yicong Yang , , , , , , , References: <20220609120622.47724-1-yangyicong@hisilicon.com> <20220609120622.47724-2-yangyicong@hisilicon.com> <05472b4ed10c694bce1a2b6dd4a0ef13ea337db3.camel@linux.intel.com> From: Yicong Yang Message-ID: <47e3aafa-aae6-051d-99ec-528f7b609b38@huawei.com> Date: Fri, 10 Jun 2022 14:54:10 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <05472b4ed10c694bce1a2b6dd4a0ef13ea337db3.camel@linux.intel.com> X-Originating-IP: [10.67.102.169] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500009.china.huawei.com (7.192.105.203) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220609_235417_985187_629DBD53 X-CRM114-Status: GOOD ( 15.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2022/6/10 6:28, Tim Chen wrote: > On Thu, 2022-06-09 at 20:06 +0800, Yicong Yang wrote: >> >> >> +/* >> + * Whether CPUs are share cache resources, which means LLC on non-cluster >> + * machines and LLC tag or L2 on machines with clusters. >> + */ >> +bool cpus_share_resources(int this_cpu, int that_cpu) > > Suggest cpus_share_lowest_cache to be a bit more informative > >> +{ >> + if (this_cpu == that_cpu) >> + return true; >> + >> + return per_cpu(sd_share_id, this_cpu) == per_cpu(sd_share_id, that_cpu); >> +} >> + >> static inline bool ttwu_queue_cond(int cpu, int wake_flags) >> { >> /* >> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h >> index 01259611beb9..b9bcfcf8d14d 100644 >> --- a/kernel/sched/sched.h >> +++ b/kernel/sched/sched.h >> @@ -1753,7 +1753,9 @@ static inline struct sched_domain *lowest_flag_domain(int cpu, int flag) >> DECLARE_PER_CPU(struct sched_domain __rcu *, sd_llc); >> DECLARE_PER_CPU(int, sd_llc_size); >> DECLARE_PER_CPU(int, sd_llc_id); >> +DECLARE_PER_CPU(int, sd_share_id); >> DECLARE_PER_CPU(struct sched_domain_shared __rcu *, sd_llc_shared); >> +DECLARE_PER_CPU(struct sched_domain __rcu *, sd_cluster); >> DECLARE_PER_CPU(struct sched_domain __rcu *, sd_numa); >> DECLARE_PER_CPU(struct sched_domain __rcu *, sd_asym_packing); >> DECLARE_PER_CPU(struct sched_domain __rcu *, sd_asym_cpucapacity); >> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c >> index 05b6c2ad90b9..0595827d481d 100644 >> --- a/kernel/sched/topology.c >> +++ b/kernel/sched/topology.c >> @@ -664,6 +664,8 @@ static void destroy_sched_domains(struct sched_domain *sd) >> DEFINE_PER_CPU(struct sched_domain __rcu *, sd_llc); >> DEFINE_PER_CPU(int, sd_llc_size); >> DEFINE_PER_CPU(int, sd_llc_id); >> +DEFINE_PER_CPU(int, sd_share_id); > > Some minor nits about the name of "sd_share_id". > It is not quite obvious what it is. > > Maybe something like sd_lowest_cache_id to denote > it is the id of lowest shared cache domain between CPU. > Thanks for the suggestion! Since Vincent and Gautham have suggested this in v1 [1], I'd like to wait a bit before changing to this to see if they have any comment. > Otherwise the patch looks good to me. You can add > > Reviewed-by: Tim Chen > Thanks. [1] https://lore.kernel.org/lkml/CAKfTPtBKLDyNPXg7uLbQ3jUnEwppfC+E29=oJ1tWzzqHsNpApw@mail.gmail.com/ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel