-----Original Message----- From: Tim Chen [mailto:tim.c.chen@linux.intel.com] Sent: Tuesday, March 16, 2021 9:54 AM To: Song Bao Hua (Barry Song) song.bao.hua@hisilicon.com; Peter Zijlstra peterz@infradead.org Cc: catalin.marinas@arm.com; will@kernel.org; rjw@rjwysocki.net; vincent.guittot@linaro.org; bp@alien8.de; tglx@linutronix.de; mingo@redhat.com; lenb@kernel.org; dietmar.eggemann@arm.com; rostedt@goodmis.org; bsegall@google.com; mgorman@suse.de; msys.mizuma@gmail.com; valentin.schneider@arm.com; gregkh@linuxfoundation.org; Jonathan Cameron jonathan.cameron@huawei.com; juri.lelli@redhat.com; mark.rutland@arm.com; sudeep.holla@arm.com; aubrey.li@linux.intel.com; linux-arm-kernel@lists.infradead.org <linux-arm-kernel@li sts.infradead.org>; linux-kernel@vger.kernel.org; linux-acpi@vger.kernel.org; x86@kernel.org; xuwei (O) xuwei5@huawei.com; Zengtao (B) prime.zeng@hisilicon.com; guodong.xu@linaro.org; yangyicong yangyicong@huawei.com; Liguozhu (Kenneth) liguozhu@hisilicon.com; linuxarm@openeuler.org; hpa@zytor.com Subject: [Linuxarm] Re: [RFC PATCH v4 3/3] scheduler: Add cluster scheduler level for x86
It seems sensible the more CPU we get in the cluster, the more we need the kernel to be aware of its existence.
Tim, it is possible for you to bring up the cpu_cluster_mask and cluster_sibling for x86 so that the topology can be represented in sysfs and be used by scheduler? It seems your patch lacks this part.
You mean having something in /sys/devices/system/cpu/cpu0/topology on cluster information so that an external program can affinitize to a cluster if it prefers to do so?
Yes. This is one of the needs. The other one is that [RFC PATCH v4 2/3] scheduler: add scheduler level for clusters depends on a valid cpu_cluster_mask()
+#if defined(CONFIG_SCHED_CLUSTER) && !defined(cpu_cluster_mask) +static inline const struct cpumask *cpu_cluster_mask(int cpu) +{ + return topology_cluster_cpumask(cpu); +} +#endif
Is x86's code able to return a valid cluster mask?
Tim
BTW, I wonder if x86 can do some improvement on your KMP_AFFINITY by leveraging the cluster topology level.
https://software.intel.com/content/www/us/en/develop/documentation/cpp-com piler-developer-guide-and-reference/top/optimization-and-programming-guide /openmp-support/openmp-library-support/thread-affinity-interface-linux-and -windows.html
KMP_AFFINITY has thread affinity modes like compact and scatter, it seems this "compact" and "scatter" can also use the cluster information as you see we are also struggling with the "compact" and "scatter" issues here in this patchset :-)
Thanks Barry
Thanks Barry