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 5EC54C43334 for ; Thu, 9 Jun 2022 22:30:20 +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:MIME-Version:References:In-Reply-To: Date:Cc:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JtG2+zfBvfsTGWGSZyrX5wRe9E/eJvISWqOfUpJ35oo=; b=opDRwc5mXXxBsJ U+p9ld4LyIQpLHYG1BFiL2nKqU4GM1PYVZLSpKbsEQgtt3iSAKqa9TZQkbg9fzj3lCwlQI10LKKxN zfjl2BZeW305bcAuCo06DSq4bu07wuH3UTN8HLBp6FhyLXLOwDzD7tGK8EpTiGPG5qAbpYK62OHue wuqry+MKc83Sot+iTh5e2+JtgaBBnr5XbJ3p041wdxHUb6RsGak1TJ560xpOFXg9cstI8SfeYU4IW zlUwStsnjUUB1bg6QOw+tIjrAnwHhJHfeA5kVQWcF6zXXOP0+nxBb1WMhfHV/UD4zuREwnddkfoQ5 yNijEqE45liReEdDAUBQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nzQdy-004POX-IU; Thu, 09 Jun 2022 22:28:46 +0000 Received: from mga04.intel.com ([192.55.52.120]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nzQdv-004PNJ-EF for linux-arm-kernel@lists.infradead.org; Thu, 09 Jun 2022 22:28:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654813723; x=1686349723; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=4aMBkYKnK6oAfQmvu2MwiSPKAfzZjPqC87w6qpy3iaU=; b=RksZSNBjsjTg/MC7tEMTbfzQC7DpdMirQkVZxztrGoenr/oEO+3tX6bP n0TDtiP8AaKamkIXPVrYILryZiSaf7s4dVxXEsLnwIaflKkMGCgkJtROt brcO43dZy4yl1LSPkzGrqDhZWMdHTIGhfUKXdyy+izBc1CuhUerACfJ2F NLfNp7SlH8YskBgwEBp8Owtp1w9odTYUVDtC0u6GidNmY/bNj9LXC26A2 F10opXPcMFeo4X8uVTzqJjAiRlBuAiMCPjrI1mJU0v788hCuTw4nomBX/ 8Ri/8F/xky2mMArZO45JdV4N4iCBi1oTWfV7tzQpOu+kbrnHR10KQ9MNz g==; X-IronPort-AV: E=McAfee;i="6400,9594,10373"; a="276211389" X-IronPort-AV: E=Sophos;i="5.91,288,1647327600"; d="scan'208";a="276211389" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2022 15:28:41 -0700 X-IronPort-AV: E=Sophos;i="5.91,288,1647327600"; d="scan'208";a="585843382" Received: from schen9-mobl.amr.corp.intel.com ([10.212.167.148]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2022 15:28:40 -0700 Message-ID: <05472b4ed10c694bce1a2b6dd4a0ef13ea337db3.camel@linux.intel.com> Subject: Re: [PATCH v4 1/2] sched: Add per_cpu cluster domain info and cpus_share_resources API From: Tim Chen To: Yicong Yang , peterz@infradead.org, mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, gautham.shenoy@amd.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, prime.zeng@huawei.com, jonathan.cameron@huawei.com, ego@linux.vnet.ibm.com, srikar@linux.vnet.ibm.com, linuxarm@huawei.com, 21cnbao@gmail.com, guodong.xu@linaro.org, hesham.almatary@huawei.com, john.garry@huawei.com, shenyang39@huawei.com Date: Thu, 09 Jun 2022 15:28:38 -0700 In-Reply-To: <20220609120622.47724-2-yangyicong@hisilicon.com> References: <20220609120622.47724-1-yangyicong@hisilicon.com> <20220609120622.47724-2-yangyicong@hisilicon.com> User-Agent: Evolution 3.34.4 (3.34.4-1.fc31) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220609_152843_539134_3370D9D5 X-CRM114-Status: GOOD ( 15.78 ) 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 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. Otherwise the patch looks good to me. You can add Reviewed-by: Tim Chen Tim _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel