sparc64: Setup a scheduling domain for highest level cache.
PATCH 1/1 sparc64: Setup a scheduling domain for highest level cache.
Individual scheduler domain should consist different hierarchy consisting of cores sharing similar property. Currently, no scheduler domain is defined separately for the cores that shares the last level cache. As a result, the scheduler fails to take advantage of cache locality while migrating tasks during load balancing.
Here are the cpu masks currently present for sparc that are/can be used in scheduler domain construction.cpu_core_map : set based on the cores that shares l1 cache. core_core_sib_map : is set based on the socket id.
The prior SPARC notion of socket was defined as highest level of shared cache. However, the MD record on T7 platforms now describes the CPUs that share the physical socket and this is no longer tied to shared cache.
That's why a separate cpu mask needs to be created that truly represent highest level of shared cache for all platforms.
--- arch/sparc/include/asm/cpudata_64.h | 5 ++- arch/sparc/include/asm/topology_64.h | 8 +++++- arch/sparc/kernel/mdesc.c | 46 ++++++++++++++++++++------------- arch/sparc/kernel/smp_64.c | 8 ++++++ 4 files changed, 46 insertions(+), 21 deletions(-)
arch/sparc/include/asm/cpudata_64.h +3 -2
@@ -24,9 +24,10 @@ typedef struct {unsigned int icache_line_size;unsigned int ecache_size;unsigned int ecache_line_size; -unsigned short sock_id; +unsigned short sock_id;/* physical package */ unsigned short core_id; -int proc_id; +unsigned short max_cache_id;/* groupings of highest shared cache */ +unsigned short proc_id;/* strand (aka HW thread) id */ } cpuinfo_sparc;DECLARE_PER_CPU (cpuinfo_sparc, __cpu_data);
arch/sparc/include/asm/topology_64.h +7 -1
@@ -44,14 +44,20 @@ int __node_distance(int, int);#define topology_physical_package_id (cpu) (cpu_data(cpu).proc_id)#define topology_core_id (cpu) (cpu_data(cpu).core_id)#define topology_core_cpumask (cpu) (&cpu_core_sib_map[cpu]) +#define topology_core_cache_cpumask (cpu) (&cpu_core_sib_cache_map[cpu])#define topology_sibling_cpumask (cpu) (&per_cpu(cpu_sibling_map, cpu))#endif /* CONFIG_SMP */ extern cpumask_t cpu_core_map[NR_CPUS ];extern cpumask_t cpu_core_sib_map[NR_CPUS ]; +extern cpumask_t cpu_core_sib_cache_map[NR_CPUS ]; + +/** +* Return cores that shares the last level cache. +*/ static inline const struct cpumask *cpu_coregroup_mask (int cpu) { -return &cpu_core_map[cpu]; +return &cpu_core_sib_cache_map[cpu]; }#endif /* _ASM_SPARC64_TOPOLOGY_H */
arch/sparc/kernel/mdesc.c +28 -18
88 lines not on this page · raw message
arch/sparc/kernel/smp_64.c +8 -0
@@ -63,9 +63,13 @@ cpumask_t cpu_core_map[NR_CPUS] __read_mostly cpumask_t cpu_core_sib_map[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = CPU_MASK_NONE }; +cpumask_t cpu_core_sib_cache_map[NR_CPUS ]__read_mostly = { + [0 ...NR_CPUS -1 ] =CPU_MASK_NONE }; +EXPORT_PER_CPU_SYMBOL (cpu_sibling_map);EXPORT_SYMBOL (cpu_core_map);EXPORT_SYMBOL (cpu_core_sib_map); +EXPORT_SYMBOL (cpu_core_sib_cache_map);static cpumask_t smp_commenced_mask;
@@ -1251,6 +1255,10 @@ void smp_fill_in_sib_core_maps(void)unsigned int j;for_each_present_cpu (j) { +if (cpu_data (i).max_cache_id = +cpu_data (j).max_cache_id) +cpumask_set_cpu (j, &cpu_core_sib_cache_map[i]); +if (cpu_data (i).sock_id =cpu_data (j).sock_id)cpumask_set_cpu (j, &cpu_core_sib_map[i]); }
Signature · 1 line
1.7.1
From: Atish Patra <[email protected]>
Date: Wed, 19 Oct 2016 18:33:29 -0600
Quoted 16 lines
Individual scheduler domain should consist different hierarchy consisting of cores sharing similar property. Currently, no scheduler domain is defined separately for the cores that shares the last level cache. As a result, the scheduler fails to take advantage of cache locality while migrating tasks during load balancing.
Here are the cpu masks currently present for sparc that are/can be used in scheduler domain construction.
cpu_core_map: set based on the cores that shares l1 cache.core_core_sib_map: is set based on the socket id.
The prior SPARC notion of socket was defined as highest level of shared cache. However, the MD record on T7 platforms now describes the CPUs that share the physical socket and this is no longer tied to shared cache.
Quoted 5 lines
That's why a separate cpu mask needs to be created that truly represent highest level of shared cache for all platforms.
Signed-off-by Atish Patra <[email protected]>Reviewed-by Chris Hyser <[email protected]>
Applied, thank you.