Re: [PATCH RESEND 0/3] Represent cluster topology and enable load balance between clusters

From: Tim Chen
Date: Mon Oct 04 2021 - 18:54:56 EST


On Sat, 2021-10-02 at 20:09 +1300, Barry Song wrote:
>
>
> Thanks, Tim, for your comments.
> I am ok to make it default "Y" for x86 after having a better doc as
> below:
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index bd27b1cdac34..940eb1fe0abb 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -1002,12 +1002,17 @@ config NR_CPUS
> to the kernel image.
>
> config SCHED_CLUSTER
> - bool "Cluster scheduler support"
> - default n
> + def_bool y
> + prompt "Cluster scheduler support"
> help
> Cluster scheduler support improves the CPU scheduler's
> decision
> - making when dealing with machines that have clusters of CPUs
> - sharing L2 cache. If unsure say N here.
> + making when dealing with machines that have clusters of
> CPUs.
> + Cluster usually means a couple of CPUs which are placed
> closely
> + by sharing mid-level caches, last-level cache tags or
> internal
> + busses. For example, on x86 Jacobsville, each 4 CPUs share
> one
> + L2 cache. This feature isn't a universal win because it can
> bring
> + a cost of slightly increased overhead in some places. If
> unsure
> + say N here.
>
> This also aligns well with SCHED_MC and SCHED_SMT in
> arch/x86/kconfig:
> config SCHED_MC
> def_bool y
> prompt "Multi-core scheduler support"
>
> config SCHED_SMT
> def_bool y if SMP
>
> But ARM64 is running in a different tradition, arch/arm64/Kconfig has
> SCHED_MC and SCHED_SMT as below:
> config SCHED_MC
> bool "Multi-core scheduler support"
> help
> ...
>
> config SCHED_SMT
> bool "SMT scheduler support"
> help
> ...
>
>

Barry,

Found one minor fix to the x86 patch to take care of compile error for
!CONFIG_SMP.

Thanks.

Tim

diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index 2548d824f103..cc164777e661 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -109,12 +109,12 @@ extern const struct cpumask *cpu_clustergroup_mask(int cpu);
#define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id)
#define topology_logical_die_id(cpu) (cpu_data(cpu).logical_die_id)
#define topology_die_id(cpu) (cpu_data(cpu).cpu_die_id)
-#define topology_cluster_id(cpu) (per_cpu(cpu_l2c_id, cpu))
#define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id)

extern unsigned int __max_die_per_package;

#ifdef CONFIG_SMP
+#define topology_cluster_id(cpu) (per_cpu(cpu_l2c_id, cpu))
#define topology_die_cpumask(cpu) (per_cpu(cpu_die_map, cpu))
#define topology_cluster_cpumask(cpu) (cpu_clustergroup_mask(cpu))
#define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu))