change scheduler domain hierarchy set-up
Subsystems (4)
[email protected]
reviewerv2 cover change scheduler domain hierarchy set-up
From: Dietmar Eggemann <[email protected]>
This patch-set cleans up the scheduler domain (sd) level initialisation code. It is based on the idea of Peter Zijlstra to use a single sd init function sketched here: https://lkml.org/lkml/2013/11/5/239
The sd level data for conventional (SMT, MC, BOOK, CPU) sd levels which can be set by the arch comprises the cpu mask and the sd topology flags for this level.
An arch can either use the existing sd level hierarchy defined in the scheduler core or specify its own complete sd level hierarchy in its topology shim layer.
This clean-up is necessary because some of the arch specific settings are just bitrot or accidents. So far, additional arch specific sd topology flags are set via flag specific weak functions, like SD_ASYM_PACKING. If in the future, we want to further distinguish the functionality of the different sd levels based on more topology information (e.g. Vincent's SD_SHARE_POWERDOMAIN flag) we do need a better interface than this.
Changes in v2:
1) Export struct sched_domain_topology_info and set_sd_topology_info() towards the arch to enable it to customize sched domain topology data.
2) Keep a default topology setup inside the scheduler for the conventional sched domain levels.
3) Sched domain level topology flags can be specified dependent on runtime information (e.g. cpu feature) and per cpu.
4) Move struct sched_domain from interface header file into private scheduler header file for data encapsulation purposes. With the deletion of the arch specific sd init macros and the sd ptr arg in arch_scale_freq_power(), struct sched_domain is no longer needed outside the scheduler core code.
What does the patch-set try to achieve:
1) Let the arch define the conventional (SMT, MC, BOOK, CPU) sched domain hierarchy. The arch specifies per sched domain level the pointer to the getter function of the corresponding cpu mask and the topology flags as well as the name of the sched domain level, the latter for debug purposes.
2) Unify the set-up code for conventional and NUMA scheduler domains. All scheduler domain topology levels are now allocated in the same function sched_init_topology(). All scheduler domains now use a common init function sd_init() which makes the existing SD_FOO_INIT macros redundant.
3) The arch is no longer limited to the default sched domain levels (SMT, MC, BOOK, CPU) but can easily define its own sched domain level hierarchy.
4) Prepare the mechanics to make it easier to integrate the provision of additional topology related data (e.g. energy information) to the scheduler.
Current limitations:
1) The patch-set has only been tested on ARM TC2 (2 clusters, one with 2 Cortex A15 and the other with 3 Cortex A7) and on an Intel i5-520M (2 cores with 2 threads each) platform.
2) For other archs it has only been compile tested for certain configurations (powerpc: chroma_defconfig, mips: ip27_defconfig,
s390: defconfig, tile: tilegx_defconfig).
The patch-set is against v3.13-rc8.
Dietmar Eggemann (11):
sched: define sched_domain_topology_info
sched: export cpu_smt_mask() and cpu_cpu_mask()
sched: define TOPOLOGY_SD_FLAGS
sched: replace SD_INIT_FUNC with sd_init()
sched: add a name to sched_domain_topology_info
sched: delete redundant sd init macros
sched: consolidate sched_init_numa() and sched_init_conv()
sched: introduce a func ptr for sd topology flags
sched: provide SD_ASYM_PACKING via topology info table
sched: delete sd ptr arg in arch_scale_freq_power()
sched: un-export struct sched_domain
arch/arm/kernel/topology.c | 4 +- arch/ia64/include/asm/topology.h | 24 --- arch/metag/include/asm/topology.h | 27 --- arch/powerpc/kernel/smp.c | 34 +++- arch/s390/include/asm/topology.h | 2 - arch/tile/include/asm/topology.h | 33 ---- include/linux/sched.h | 119 ++++--------- include/linux/topology.h | 127 ++------------ kernel/sched/core.c | 351 ++++++++++++++++++------------------- kernel/sched/fair.c | 10 +- kernel/sched/sched.h | 169 ++++++++++++++---- 11 files changed, 384 insertions(+), 516 deletions(-)
Signature · 1 line
1.7.9.5
[email protected]
reviewerRFC PATCH v2 1/11 sched: define sched_domain_topology_info
From: Dietmar Eggemann <[email protected]>
The idea behind creating the struct sched_domain_topology_info is to be able to only export the scheduler data which can be changed by the arch.
Exporting the existing struct sched_domain_topology_level means that we also have to expose struct sd_data anf other scheduler internals.
The extra step of allocating the sched_domain_topology array for pure conventional sched domain set-up doesn't harm when this will be consolidated with the existing code in the sched_init_numa() function.
This patch extracts the topology information which can be set by the arch (cpu mask and sd topology flags) from the existing struct sched_domain_topology and puts it in struct sched_domain_topology_info.
The struct sched_domain_topology_info is exported in include/linux/sched.h. It defines the default struct sched_domain_topology_info default_topology_info[] for all conventional scheduler domain level (SMT, MC, BOOK, CPU).
In case an arch wants to use a different default topology info array, it can overwrite the pointer to this table via the new function set_sd_topology_info().
--- include/linux/sched.h | 10 ++++++++++ kernel/sched/core.c | 29 ++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-)
include/linux/sched.h +10 -0
@@ -2780,4 +2780,14 @@ static inline unsigned long rlimit_max(unsigned int limit) return task_rlimit_max(current, limit); } +typedef const struct cpumask *(*sched_domain_mask_f )(int cpu); + +struct sched_domain_topology_info { +sched_domain_mask_f mask; +int flags; +}; + +extern void +set_sd_topology_info (struct sched_domain_topology_info *ti,unsigned int s); +#endif
kernel/sched/core.c +28 -1
@@ -5014,7 +5014,6 @@ enum s_alloc {struct sched_domain_topology_level ;typedef struct sched_domain *(*sched_domain_init_f )(struct sched_domain_topology_level *tl,int cpu); -typedef const struct cpumask *(*sched_domain_mask_f )(int cpu);#define SDTL_OVERLAP 0x01
@@ -5393,7 +5392,35 @@ static struct sched_domain_topology_level default_topology[] = { { NULL, }, }; +/* +* Topology info list, bottom-up. +*/ +static struct sched_domain_topology_info default_topology_info[] = { +#ifdef CONFIG_SCHED_SMT + { cpu_smt_mask,SD_SHARE_CPUPOWER |SD_SHARE_PKG_RESOURCES }, +#endif +#ifdef CONFIG_SCHED_MC + { cpu_coregroup_mask,SD_SHARE_PKG_RESOURCES }, +#endif +#ifdef CONFIG_SCHED_BOOK + { cpu_book_mask, }, +#endif + { cpu_cpu_mask, }, + {NULL , }, +}; +static struct sched_domain_topology_level *sched_domain_topology = default_topology; +static struct sched_domain_topology_info *sched_domain_topology_info = + default_topology_info; +static unsigned int sched_domain_topology_info_size = +ARRAY_SIZE (default_topology_info); + +void +set_sd_topology_info (struct sched_domain_topology_info *ti,unsigned int s) +{ + sched_domain_topology_info = ti; + sched_domain_topology_info_size = s; +}#define for_each_sd_topology (tl) \ for (tl = sched_domain_topology; tl->init; tl++)
Signature · 1 line
1.7.9.5
[email protected]
reviewerRFC PATCH v2 2/11 sched: export cpu_smt_mask() and cpu_cpu_mask()
In reply to [email protected]From: Dietmar Eggemann <[email protected]>
Move cpu_smt_mask() and cpu_cpu_mask() from scheduler code into the include/linux/topology.h so that an arch can use them for specifying cpu masks for its topology info array.
--- include/linux/topology.h | 12 ++++++++++++ kernel/sched/core.c | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-)
include/linux/topology.h +12 -0
@@ -295,4 +295,16 @@ static inline int cpu_to_mem(int cpu)#define topology_core_cpumask (cpu) cpumask_of(cpu)#endif +#ifdef CONFIG_SCHED_SMT +static inline const struct cpumask *cpu_smt_mask (int cpu) +{ +return topology_thread_cpumask (cpu); +} +#endif + +static inline const struct cpumask *cpu_cpu_mask (int cpu) +{ +return cpumask_of_node (cpu_to_node (cpu)); +} +#endif /* _LINUX_TOPOLOGY_H */
kernel/sched/core.c +0 -12
@@ -4988,11 +4988,6 @@ static int __init isolated_cpu_setup(char *str)__setup ("isolcpus=" , isolated_cpu_setup); -static const struct cpumask *cpu_cpu_mask (int cpu) -{ -return cpumask_of_node (cpu_to_node (cpu)); -} -struct sd_data {struct sched_domain **__percpu sd;struct sched_group **__percpu sg;
@@ -5368,13 +5363,6 @@ static void claim_allocations(int cpu, struct sched_domain *sd) *per_cpu_ptr (sdd->sgp, cpu) =NULL ; } -#ifdef CONFIG_SCHED_SMT -static const struct cpumask *cpu_smt_mask (int cpu) -{ -return topology_thread_cpumask (cpu); -} -#endif -/* * Topology list, bottom-up. */
Signature · 1 line
1.7.9.5
[email protected]
reviewerRFC PATCH v2 3/11 sched: define TOPOLOGY_SD_FLAGS
In reply to [email protected]From: Dietmar Eggemann <[email protected]>
TOPOLOGY_SD_FLAGS contains all SD flags which provide topology related information towards the scheduler. All other SD flags describe scheduler behavioural aspects. The aim of TOPOLOGY_SD_FLAGS is to be able to check that the arch only specifies topology related flags in the topology info array.
--- kernel/sched/sched.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
kernel/sched/sched.h +16 -0
@@ -1414,3 +1414,19 @@ static inline u64 irq_time_read(int cpu) }#endif /* CONFIG_64BIT */ #endif /* CONFIG_IRQ_TIME_ACCOUNTING */ + +/* +* SD_flags allowed in topology descriptions. +* +* SD_SHARE_CPUPOWER - describes SMT topologies +* SD_SHARE_PKG_RESOURCES - describes shared caches +* SD_NUMA - describes NUMA topologies +* +* Odd one out: +* SD_ASYM_PACKING - describes SMT quirks +*/ +#define TOPOLOGY_SD_FLAGS \ + (SD_SHARE_CPUPOWER | \ + SD_SHARE_PKG_RESOURCES | \ + SD_NUMA | \ + SD_ASYM_PACKING)
Signature · 1 line
1.7.9.5
[email protected]
reviewerRFC PATCH v2 4/11 sched: replace SD_INIT_FUNC with sd_init()
In reply to [email protected]From: Dietmar Eggemann <[email protected]>
This patch incorporates struct sched_domain_topology_info info into struct sched_domain_topology_level. It updates sd_init_numa() to reflect the change that conventional (SMT, MC, BOOK, CPU) level initialization relies on the topology_info[] array and not on the default_topology[] any more.
Moreover a counterpart function sched_init_conv() is introduced to handle the allocation of the topology array for a !CONFIG_NUMA system.
The patch deletes the default topology array default_topology[] and the SD_INIT_FUNC() macro which are not used any more. The function sd_local_flags() is deleted too and the appropriate functionality is directly incorporated into the NUMA specific condition path in sd_init().
--- kernel/sched/core.c | 247 ++++++++++++++++++++++++++++----------------------- 1 file changed, 135 insertions(+), 112 deletions(-)
kernel/sched/core.c +135 -112
@@ -5006,15 +5006,10 @@ enum s_alloc { sa_none, }; -struct sched_domain_topology_level ; - -typedef struct sched_domain *(*sched_domain_init_f )(struct sched_domain_topology_level *tl,int cpu); -#define SDTL_OVERLAP 0x01struct sched_domain_topology_level { -sched_domain_init_f init; -sched_domain_mask_f mask; +struct sched_domain_topology_info info;int flags;int numa_level;struct sd_data data;
@@ -5254,28 +5249,6 @@ int __weak arch_sd_sibling_asym_packing(void)# define SD_INIT_NAME (sd, type) do { } while (0)#endif -#define SD_INIT_FUNC (type) \ -static noinline struct sched_domain * \ -sd_init_##type(struct sched_domain_topology_level *tl, int cpu) \ -{ \ - struct sched_domain *sd = *per_cpu_ptr(tl->data.sd, cpu); \ - *sd = SD_##type##_INIT; \ - SD_INIT_NAME(sd, type); \ - sd->private = &tl->data; \ - return sd; \ -} - -SD_INIT_FUNC(CPU) -#ifdef CONFIG_SCHED_SMT - SD_INIT_FUNC(SIBLING) -#endif -#ifdef CONFIG_SCHED_MC - SD_INIT_FUNC(MC) -#endif -#ifdef CONFIG_SCHED_BOOK - SD_INIT_FUNC(BOOK) -#endif -static int default_relax_domain_level =-1 ;int sched_domain_level_max;
@@ -5364,23 +5337,6 @@ static void claim_allocations(int cpu, struct sched_domain *sd) }/* -* Topology list, bottom-up. -*/ -static struct sched_domain_topology_level default_topology[] = { -#ifdef CONFIG_SCHED_SMT - { sd_init_SIBLING, cpu_smt_mask, }, -#endif -#ifdef CONFIG_SCHED_MC - { sd_init_MC, cpu_coregroup_mask, }, -#endif -#ifdef CONFIG_SCHED_BOOK - { sd_init_BOOK, cpu_book_mask, }, -#endif - { sd_init_CPU, cpu_cpu_mask, }, - {NULL , }, -}; - -/* * Topology info list, bottom-up. */ static struct sched_domain_topology_info default_topology_info[] = {
@@ -5394,10 +5350,9 @@ static struct sched_domain_topology_info default_topology_info[] = { { cpu_book_mask, }, #endif { cpu_cpu_mask, }, - { NULL, }, }; -static struct sched_domain_topology_level *sched_domain_topology = default_topology; +static struct sched_domain_topology_level *sched_domain_topology; static struct sched_domain_topology_info *sched_domain_topology_info = default_topology_info; static unsigned int sched_domain_topology_info_size =
@@ -5411,7 +5366,7 @@ set_sd_topology_info(struct sched_domain_topology_info *ti, unsigned int s) }#define for_each_sd_topology (tl) \ - for (tl = sched_domain_topology; tl->init; tl++) + for (tl = sched_domain_topology; tl->info.mask; tl++)#ifdef CONFIG_NUMA
@@ -5420,61 +5375,6 @@ static int *sched_domains_numa_distance;static struct cpumask ***sched_domains_numa_masks;static int sched_domains_curr_level; -static inline int sd_local_flags (int level) -{ -if (sched_domains_numa_distance[level] >RECLAIM_DISTANCE ) -return 0 ; - -return SD_BALANCE_EXEC |SD_BALANCE_FORK |SD_WAKE_AFFINE ; -} - -static struct sched_domain * -sd_numa_init (struct sched_domain_topology_level *tl,int cpu) -{ -struct sched_domain *sd = *per_cpu_ptr (tl->data.sd, cpu); -int level = tl->numa_level; -int sd_weight =cpumask_weight ( - sched_domains_numa_masks[level][cpu_to_node (cpu)]); - - *sd = (struct sched_domain ){ - .min_interval = sd_weight, - .max_interval =2 *sd_weight, - .busy_factor =32 , - .imbalance_pct =125 , - .cache_nice_tries =2 , - .busy_idx =3 , - .idle_idx =2 , - .newidle_idx =0 , - .wake_idx =0 , - .forkexec_idx =0 , - - .flags =1 *SD_LOAD_BALANCE - |1 *SD_BALANCE_NEWIDLE - |0 *SD_BALANCE_EXEC - |0 *SD_BALANCE_FORK - |0 *SD_BALANCE_WAKE - |0 *SD_WAKE_AFFINE - |0 *SD_SHARE_CPUPOWER - |0 *SD_SHARE_PKG_RESOURCES - |1 *SD_SERIALIZE - |0 *SD_PREFER_SIBLING - |1 *SD_NUMA - |sd_local_flags (level) - , - .last_balance = jiffies, - .balance_interval = sd_weight, - }; -SD_INIT_NAME (sd,NUMA ); - sd->private = &tl->data; - -/* -* Ugly hack to pass state to sd_numa_mask()... -*/ - sched_domains_curr_level = tl->numa_level; - -return sd; -} -static const struct cpumask *sd_numa_mask (int cpu) {return sched_domains_numa_masks[sched_domains_curr_level][cpu_to_node (cpu)];
@@ -5520,6 +5420,7 @@ static void sched_init_numa(void) {int next_distance, curr_distance =node_distance (0 ,0 );struct sched_domain_topology_level *tl; +struct sched_domain_topology_info *ti = sched_domain_topology_info;int level =0 ;int i, j, k;
@@ -5618,24 +5519,29 @@ static void sched_init_numa(void) } } - tl =kzalloc ((ARRAY_SIZE (default_topology) + level) * -sizeof (struct sched_domain_topology_level ),GFP_KERNEL ); +/* +* An extra empty struct sched_domain_topology_level element at the end +* of the array is needed to let for_each_sd_topology() work correctly. +*/ + tl =kzalloc ((sched_domain_topology_info_size + level +1 ) * +sizeof (struct sched_domain_topology_level ), +GFP_KERNEL );if (!tl)return ;/* -* Copy the default topology bits.. +* Copy the topology info bits.. */ -for (i =0 ; default_topology[i].init; i++) - tl[i] = default_topology[i]; +for (i =0 ; i < sched_domain_topology_info_size; i++) + tl[i].info = ti[i];/* * .. and append 'j' levels of NUMA goodness. */ for (j =0 ; j < level; i++, j++) { tl[i] = (struct sched_domain_topology_level ){ - .init = sd_numa_init, - .mask = sd_numa_mask, + .info.mask = sd_numa_mask, + .info.flags =SD_NUMA , .flags =SDTL_OVERLAP , .numa_level = j, };
@@ -5646,6 +5552,10 @@ static void sched_init_numa(void) sched_domains_numa_levels = level; } +static void sched_init_conv (void ) +{ +} +static void sched_domains_numa_masks_set (int cpu) {int i, j;
@@ -5698,6 +5608,31 @@ static inline void sched_init_numa(void) { } +static void sched_init_conv (void ) +{ +struct sched_domain_topology_level *tl; +struct sched_domain_topology_info *ti = sched_domain_topology_info; +int i; + +/* +* An extra empty struct sched_domain_topology_level element at the end +* of the array is needed to let for_each_sd_topology() work correctly. +*/ + tl =kzalloc ((sched_domain_topology_info_size +1 ) * +sizeof (struct sched_domain_topology_level ), +GFP_KERNEL ); +if (!tl) +return ; + +/* +* Copy the topology info bits.. +*/ +for (i =0 ; i < sched_domain_topology_info_size; i++) + tl[i].info = ti[i]; + + sched_domain_topology = tl; +} +static int sched_domains_numa_masks_update (struct notifier_block *nfb,unsigned long action,void *hcpu)
@@ -5706,6 +5641,93 @@ static int sched_domains_numa_masks_update(struct notifier_block *nfb, }#endif /* CONFIG_NUMA */ +static struct sched_domain * +sd_init (struct sched_domain_topology_level *tl,int cpu) +{ +struct sched_domain *sd = *per_cpu_ptr (tl->data.sd, cpu); +int sd_weight; + +#ifdef CONFIG_NUMA +/* +* Ugly hack to pass state to sd_numa_mask()... +*/ + sched_domains_curr_level = tl->numa_level; +#endif + + sd_weight =cpumask_weight (tl->info.mask (cpu)); + +if (WARN_ONCE (tl->info.flags & ~TOPOLOGY_SD_FLAGS , +"wrong flags in topology info\n" )) + tl->info.flags &= ~TOPOLOGY_SD_FLAGS ; + + *sd = (struct sched_domain ){ + .min_interval = sd_weight, + .max_interval =2 *sd_weight, + .busy_factor =64 , + .imbalance_pct =125 , + + .flags =1 *SD_LOAD_BALANCE + |1 *SD_BALANCE_NEWIDLE + |1 *SD_BALANCE_EXEC + |1 *SD_BALANCE_FORK + |1 *SD_WAKE_AFFINE + | tl->info.flags + , + + .last_balance = jiffies, + .balance_interval = sd_weight, + }; + +/* +* Convert topological properties into behaviour. +*/ + +if (sd->flags &SD_SHARE_CPUPOWER ) { + sd->imbalance_pct =110 ; + sd->smt_gain =1178 ;/* ~15% */ + +/* +* Call SMT specific arch topology function. +* This goes away once the powerpc arch uses +* the new interface for scheduler domain +* setup. +*/ + sd->flags |=arch_sd_sibling_asym_packing (); + +SD_INIT_NAME (sd,SMT ); + }else if (sd->flags &SD_SHARE_PKG_RESOURCES ) { + sd->cache_nice_tries =1 ; + sd->busy_idx =2 ; + +SD_INIT_NAME (sd,MC ); +#ifdef CONFIG_NUMA + }else if (sd->flags &SD_NUMA ) { + sd->busy_factor =32 , + sd->cache_nice_tries =2 ; + sd->busy_idx =3 ; + sd->idle_idx =2 ; + sd->flags |=SD_SERIALIZE ; +if (sched_domains_numa_distance[tl->numa_level] + >RECLAIM_DISTANCE ) { + sd->flags &= ~(SD_BALANCE_EXEC | +SD_BALANCE_FORK | +SD_WAKE_AFFINE ); + } +#endif + }else { + sd->cache_nice_tries =1 ; + sd->busy_idx =2 ; + sd->idle_idx =1 ; + sd->flags |=SD_PREFER_SIBLING ; + +SD_INIT_NAME (sd,CPU ); + } + + sd->private = &tl->data; + +return sd; +} +static int __sdt_alloc (const struct cpumask *cpu_map) {struct sched_domain_topology_level *tl;
@@ -5795,11 +5817,11 @@ struct sched_domain *build_sched_domain(struct sched_domain_topology_level *tl, const struct cpumask *cpu_map, struct sched_domain_attr *attr, struct sched_domain *child, int cpu) { - struct sched_domain *sd = tl->init(tl, cpu); + struct sched_domain *sd = sd_init(tl, cpu);if (!sd)return child; -cpumask_and (sched_domain_span (sd), cpu_map, tl->mask (cpu)); +cpumask_and (sched_domain_span (sd), cpu_map, tl->info.mask (cpu));if (child) { sd->level = child->level +1 ; sched_domain_level_max =max (sched_domain_level_max, sd->level);
@@ -6138,6 +6160,7 @@ void __init sched_init_smp(void)alloc_cpumask_var (&non_isolated_cpus,GFP_KERNEL );alloc_cpumask_var (&fallback_doms,GFP_KERNEL ); +sched_init_conv ();sched_init_numa ();/*
Signature · 1 line
1.7.9.5
[email protected]
reviewerRFC PATCH v2 5/11 sched: add a name to sched_domain_topology_info
In reply to [email protected]From: Dietmar Eggemann <[email protected]>
With this patch, an arbitrary name for a sd level has to be specified in the topology info table. This feature is still only active if CONFIG_SCHED_DEBUG is set.
--- include/linux/sched.h | 11 ++++++++++- kernel/sched/core.c | 23 +++++++---------------- 2 files changed, 17 insertions(+), 17 deletions(-)
include/linux/sched.h +10 -1
@@ -2784,9 +2784,18 @@ typedef const struct cpumask *(*sched_domain_mask_f)(int cpu);struct sched_domain_topology_info {sched_domain_mask_f mask; -int flags; +int flags; +#ifdef CONFIG_SCHED_DEBUG +char *name; +#endif }; +#ifdef CONFIG_SCHED_DEBUG +# define SD_NAME (n) .name = #n +#else +# define SD_NAME (n) +#endif +extern void set_sd_topology_info (struct sched_domain_topology_info *ti,unsigned int s);
kernel/sched/core.c +7 -16
@@ -5243,12 +5243,6 @@ int __weak arch_sd_sibling_asym_packing(void)* Non-inlined to reduce accumulated stack pressure in build_sched_domains() */ -#ifdef CONFIG_SCHED_DEBUG -# define SD_INIT_NAME (sd, type) sd->name = #type -#else -# define SD_INIT_NAME (sd, type) do { } while (0) -#endif -static int default_relax_domain_level =-1 ;int sched_domain_level_max;
@@ -5341,15 +5335,15 @@ static void claim_allocations(int cpu, struct sched_domain *sd)*/ static struct sched_domain_topology_info default_topology_info[] = { #ifdef CONFIG_SCHED_SMT - { cpu_smt_mask,SD_SHARE_CPUPOWER |SD_SHARE_PKG_RESOURCES }, + { cpu_smt_mask,SD_SHARE_CPUPOWER |SD_SHARE_PKG_RESOURCES ,SD_NAME (SIBLING ) }, #endif #ifdef CONFIG_SCHED_MC - { cpu_coregroup_mask,SD_SHARE_PKG_RESOURCES }, + { cpu_coregroup_mask,SD_SHARE_PKG_RESOURCES ,SD_NAME (MC ) }, #endif #ifdef CONFIG_SCHED_BOOK - { cpu_book_mask, }, + { cpu_book_mask,SD_NAME (BOOK ) }, #endif - { cpu_cpu_mask, }, + { cpu_cpu_mask,SD_NAME (CPU ) }, };static struct sched_domain_topology_level *sched_domain_topology;
@@ -5676,6 +5670,9 @@ sd_init(struct sched_domain_topology_level *tl, int cpu) .last_balance = jiffies, .balance_interval = sd_weight, +#ifdef CONFIG_SCHED_DEBUG + .name = tl->info.name, +#endif };/*
@@ -5693,13 +5690,9 @@ sd_init(struct sched_domain_topology_level *tl, int cpu)* setup. */ sd->flags |=arch_sd_sibling_asym_packing (); - -SD_INIT_NAME (sd,SMT ); }else if (sd->flags &SD_SHARE_PKG_RESOURCES ) { sd->cache_nice_tries =1 ; sd->busy_idx =2 ; - -SD_INIT_NAME (sd,MC ); #ifdef CONFIG_NUMA }else if (sd->flags &SD_NUMA ) { sd->busy_factor = 32,
@@ -5719,8 +5712,6 @@ sd_init(struct sched_domain_topology_level *tl, int cpu) sd->busy_idx =2 ; sd->idle_idx =1 ; sd->flags |=SD_PREFER_SIBLING ; - -SD_INIT_NAME (sd,CPU ); } sd->private = &tl->data;
Signature · 1 line
1.7.9.5
[email protected]
reviewerRFC PATCH v2 6/11 sched: delete redundant sd init macros
In reply to [email protected]From: Dietmar Eggemann <[email protected]>
This patch deletes all occurrences of SD_SIBLING_INIT, SD_MC_INIT, SD_BOOK_INIT and SD_CPU_INIT.
The SD_NODE_INIT in arch/metag/include/asm/topology.h seems to be leftover, probably because the metag arch got introduced at the same time (v3.9) the other archs moved away from SD_NODE_INIT.
--- arch/ia64/include/asm/topology.h | 24 -------- arch/metag/include/asm/topology.h | 27 --------- arch/s390/include/asm/topology.h | 2 - arch/tile/include/asm/topology.h | 33 ----------- include/linux/topology.h | 115 ------------------------------------- 5 files changed, 201 deletions(-)
arch/ia64/include/asm/topology.h +0 -24
@@ -46,30 +46,6 @@void build_cpu_to_node_map (void ); -#define SD_CPU_INIT (struct sched_domain) { \ - .parent = NULL, \ - .child = NULL, \ - .groups = NULL, \ - .min_interval = 1, \ - .max_interval = 4, \ - .busy_factor = 64, \ - .imbalance_pct = 125, \ - .cache_nice_tries = 2, \ - .busy_idx = 2, \ - .idle_idx = 1, \ - .newidle_idx = 0, \ - .wake_idx = 0, \ - .forkexec_idx = 0, \ - .flags = SD_LOAD_BALANCE \ - | SD_BALANCE_NEWIDLE \ - | SD_BALANCE_EXEC \ - | SD_BALANCE_FORK \ - | SD_WAKE_AFFINE, \ - .last_balance = jiffies, \ - .balance_interval = 1, \ - .nr_balance_failed = 0, \ -} -#endif /* CONFIG_NUMA */ #ifdef CONFIG_SMP
arch/metag/include/asm/topology.h +0 -27
@@ -3,33 +3,6 @@#ifdef CONFIG_NUMA -/* sched_domains SD_NODE_INIT for Meta machines */ -#define SD_NODE_INIT (struct sched_domain) { \ - .parent = NULL, \ - .child = NULL, \ - .groups = NULL, \ - .min_interval = 8, \ - .max_interval = 32, \ - .busy_factor = 32, \ - .imbalance_pct = 125, \ - .cache_nice_tries = 2, \ - .busy_idx = 3, \ - .idle_idx = 2, \ - .newidle_idx = 0, \ - .wake_idx = 0, \ - .forkexec_idx = 0, \ - .flags = SD_LOAD_BALANCE \ - | SD_BALANCE_FORK \ - | SD_BALANCE_EXEC \ - | SD_BALANCE_NEWIDLE \ - | SD_SERIALIZE, \ - .last_balance = jiffies, \ - .balance_interval = 1, \ - .nr_balance_failed = 0, \ - .max_newidle_lb_cost = 0, \ - .next_decay_max_lb_cost = jiffies, \ -} -#define cpu_to_node (cpu) ((void)(cpu), 0)#define parent_node (node) ((void)(node), 0)
arch/s390/include/asm/topology.h +0 -2
@@ -64,8 +64,6 @@ static inline void s390_init_cpu_topology(void) };#endif -#define SD_BOOK_INIT SD_CPU_INIT -#include <asm-generic/topology.h> #endif /* _ASM_S390_TOPOLOGY_H */
arch/tile/include/asm/topology.h +0 -33
@@ -44,39 +44,6 @@ static inline const struct cpumask *cpumask_of_node(int node)/* For now, use numa node -1 for global allocation. */ #define pcibus_to_node (bus) ((void)(bus), -1) -/* -* TILE architecture has many cores integrated in one processor, so we need -* setup bigger balance_interval for both CPU/NODE scheduling domains to -* reduce process scheduling costs. -*/ - -/* sched_domains SD_CPU_INIT for TILE architecture */ -#define SD_CPU_INIT (struct sched_domain) { \ - .min_interval = 4, \ - .max_interval = 128, \ - .busy_factor = 64, \ - .imbalance_pct = 125, \ - .cache_nice_tries = 1, \ - .busy_idx = 2, \ - .idle_idx = 1, \ - .newidle_idx = 0, \ - .wake_idx = 0, \ - .forkexec_idx = 0, \ - \ - .flags = 1*SD_LOAD_BALANCE \ - | 1*SD_BALANCE_NEWIDLE \ - | 1*SD_BALANCE_EXEC \ - | 1*SD_BALANCE_FORK \ - | 0*SD_BALANCE_WAKE \ - | 0*SD_WAKE_AFFINE \ - | 0*SD_SHARE_CPUPOWER \ - | 0*SD_SHARE_PKG_RESOURCES \ - | 0*SD_SERIALIZE \ - , \ - .last_balance = jiffies, \ - .balance_interval = 32, \ -} -/* By definition, we create nodes based on online memory. */ #define node_has_online_mem (nid) 1
include/linux/topology.h +0 -115
121 lines not on this page · raw message
Signature · 1 line
1.7.9.5
[email protected]
reviewerRFC PATCH v2 7/11 sched: consolidate sched_init_numa() and sched_init_conv()
In reply to [email protected]From: Dietmar Eggemann <[email protected]>
Consolidate sched_init_numa() and sched_init_conv() into one function sched_init_topology().
--- kernel/sched/core.c | 164 +++++++++++++++++++++------------------------------ 1 file changed, 68 insertions(+), 96 deletions(-)
kernel/sched/core.c +68 -96
@@ -5410,13 +5410,72 @@ static bool find_numa_distance(int distance)return false; } -static void sched_init_numa (void ) +static void sched_domains_numa_masks_set (int cpu) +{ +int i, j; +int node =cpu_to_node (cpu); + +for (i =0 ; i < sched_domains_numa_levels; i++) { +for (j =0 ; j < nr_node_ids; j++) { +if (node_distance (j, node) <= sched_domains_numa_distance[i]) +cpumask_set_cpu (cpu, sched_domains_numa_masks[i][j]); + } + } +} + +static void sched_domains_numa_masks_clear (int cpu) +{ +int i, j; +for (i =0 ; i < sched_domains_numa_levels; i++) { +for (j =0 ; j < nr_node_ids; j++) +cpumask_clear_cpu (cpu, sched_domains_numa_masks[i][j]); + } +} + +/* +* Update sched_domains_numa_masks[level][node] array when new cpus +* are onlined. +*/ +static int sched_domains_numa_masks_update (struct notifier_block *nfb, +unsigned long action, +void *hcpu) +{ +int cpu = (long )hcpu; + +switch (action & ~CPU_TASKS_FROZEN ) { +case CPU_ONLINE : +sched_domains_numa_masks_set (cpu); +break ; + +case CPU_DEAD : +sched_domains_numa_masks_clear (cpu); +break ; + +default : +return NOTIFY_DONE ; + } + +return NOTIFY_OK ; +} +#else +static int sched_domains_numa_masks_update (struct notifier_block *nfb, +unsigned long action, +void *hcpu) +{ +return 0 ; +} +#endif /* CONFIG_NUMA */ + +static void sched_init_topology (void ) { -int next_distance, curr_distance =node_distance (0 ,0 );struct sched_domain_topology_level *tl;struct sched_domain_topology_info *ti = sched_domain_topology_info;int level =0 ; -int i, j, k; +int i; + +#ifdef CONFIG_NUMA +int next_distance, curr_distance =node_distance (0 ,0 ); +int j, k; sched_domains_numa_distance =kzalloc (sizeof (int ) * nr_node_ids,GFP_KERNEL );if (!sched_domains_numa_distance)
@@ -5512,6 +5571,7 @@ static void sched_init_numa(void) } } } +#endif /* CONFIG_NUMA */ /* * An extra empty struct sched_domain_topology_level element at the end
@@ -5529,6 +5589,9 @@ static void sched_init_numa(void)for (i =0 ; i < sched_domain_topology_info_size; i++) tl[i].info = ti[i]; + sched_domain_topology = tl; + +#ifdef CONFIG_NUMA /* * .. and append 'j' levels of NUMA goodness. */
@@ -5541,99 +5604,9 @@ static void sched_init_numa(void) }; } - sched_domain_topology = tl; - sched_domains_numa_levels = level; -} - -static void sched_init_conv (void ) -{ -} - -static void sched_domains_numa_masks_set (int cpu) -{ -int i, j; -int node =cpu_to_node (cpu); - -for (i =0 ; i < sched_domains_numa_levels; i++) { -for (j =0 ; j < nr_node_ids; j++) { -if (node_distance (j, node) <= sched_domains_numa_distance[i]) -cpumask_set_cpu (cpu, sched_domains_numa_masks[i][j]); - } - } -} - -static void sched_domains_numa_masks_clear (int cpu) -{ -int i, j; -for (i =0 ; i < sched_domains_numa_levels; i++) { -for (j =0 ; j < nr_node_ids; j++) -cpumask_clear_cpu (cpu, sched_domains_numa_masks[i][j]); - } -} - -/* -* Update sched_domains_numa_masks[level][node] array when new cpus -* are onlined. -*/ -static int sched_domains_numa_masks_update (struct notifier_block *nfb, -unsigned long action, -void *hcpu) -{ -int cpu = (long )hcpu; - -switch (action & ~CPU_TASKS_FROZEN ) { -case CPU_ONLINE : -sched_domains_numa_masks_set (cpu); -break ; - -case CPU_DEAD : -sched_domains_numa_masks_clear (cpu); -break ; - -default : -return NOTIFY_DONE ; - } - -return NOTIFY_OK ; -} -#else -static inline void sched_init_numa (void ) -{ -} - -static void sched_init_conv (void ) -{ -struct sched_domain_topology_level *tl; -struct sched_domain_topology_info *ti = sched_domain_topology_info; -int i; - -/* -* An extra empty struct sched_domain_topology_level element at the end -* of the array is needed to let for_each_sd_topology() work correctly. -*/ - tl =kzalloc ((sched_domain_topology_info_size +1 ) * -sizeof (struct sched_domain_topology_level ), -GFP_KERNEL ); -if (!tl) -return ; - -/* -* Copy the topology info bits.. -*/ -for (i =0 ; i < sched_domain_topology_info_size; i++) - tl[i].info = ti[i]; - - sched_domain_topology = tl; -} - -static int sched_domains_numa_masks_update (struct notifier_block *nfb, -unsigned long action, -void *hcpu) -{ -return 0 ; -}#endif /* CONFIG_NUMA */ +}static struct sched_domain *sd_init (struct sched_domain_topology_level *tl,int cpu)
@@ -6151,8 +6124,7 @@ void __init sched_init_smp(void)alloc_cpumask_var (&non_isolated_cpus,GFP_KERNEL );alloc_cpumask_var (&fallback_doms,GFP_KERNEL ); -sched_init_conv (); -sched_init_numa (); +sched_init_topology ();/* * There's no userspace yet to cause hotplug operations; hence all the
Signature · 1 line
1.7.9.5
[email protected]
reviewerRFC PATCH v2 8/11 sched: introduce a func ptr for sd topology flags
In reply to [email protected]From: Dietmar Eggemann <[email protected]>
To be able to set sd topology flags via the topology_info[] table dependent on runtime information (cpu feature or per cpu), this patch changes the provision of the sd topology flags from a simple int to a func ptr.
The default flags func ptr for SMT and MC level are defined in include/linux/sched.h. Since there are no sd topology flags for BOOK and CPU level in the default topology info table, no default flags func ptr for these level are defined. The function sd_init() can handle the fact that there is no sd devel flags func ptr defined.
The sd topology flags func ptr definition has an int cpu argument which is only necessary when we start to set up sd topology flags differently for different sched groups.
--- include/linux/sched.h | 15 ++++++++++++++- kernel/sched/core.c | 19 +++++++++++++------ 2 files changed, 27 insertions(+), 7 deletions(-)
include/linux/sched.h +14 -1
@@ -2781,10 +2781,11 @@ static inline unsigned long rlimit_max(unsigned int limit) }typedef const struct cpumask *(*sched_domain_mask_f )(int cpu); +typedef int (*sched_domain_flags_f )(int cpu);struct sched_domain_topology_info {sched_domain_mask_f mask; -int flags; +sched_domain_flags_f flags;#ifdef CONFIG_SCHED_DEBUG char *name;#endif
@@ -2799,4 +2800,16 @@ struct sched_domain_topology_info {extern void set_sd_topology_info (struct sched_domain_topology_info *ti,unsigned int s); +#ifdef CONFIG_SCHED_SMT +static inline int cpu_smt_flags (int cpu) +{ +return SD_SHARE_CPUPOWER |SD_SHARE_PKG_RESOURCES ; +} +#endif + +static inline int cpu_coregroup_flags (int cpu) +{ +return SD_SHARE_PKG_RESOURCES ; +} +#endif
kernel/sched/core.c +13 -6
@@ -5335,10 +5335,10 @@ static void claim_allocations(int cpu, struct sched_domain *sd)*/ static struct sched_domain_topology_info default_topology_info[] = { #ifdef CONFIG_SCHED_SMT - { cpu_smt_mask,SD_SHARE_CPUPOWER |SD_SHARE_PKG_RESOURCES ,SD_NAME (SIBLING ) }, + { cpu_smt_mask, cpu_smt_flags,SD_NAME (SIBLING ) }, #endif #ifdef CONFIG_SCHED_MC - { cpu_coregroup_mask,SD_SHARE_PKG_RESOURCES ,SD_NAME (MC ) }, + { cpu_coregroup_mask, cpu_coregroup_flags,SD_NAME (MC ) }, #endif #ifdef CONFIG_SCHED_BOOK { cpu_book_mask, SD_NAME(BOOK) },
@@ -5374,6 +5374,11 @@ static const struct cpumask *sd_numa_mask(int cpu)return sched_domains_numa_masks[sched_domains_curr_level][cpu_to_node (cpu)]; } +static int sd_numa_flags (int cpu) +{ +return SD_NUMA ; +} +static void sched_numa_warn (const char *str) {static int done = false;
@@ -5598,7 +5603,7 @@ static void sched_init_topology(void)for (j =0 ; j < level; i++, j++) { tl[i] = (struct sched_domain_topology_level ){ .info.mask = sd_numa_mask, - .info.flags =SD_NUMA , + .info.flags = sd_numa_flags, .flags =SDTL_OVERLAP , .numa_level = j, };
@@ -5613,6 +5618,7 @@ sd_init(struct sched_domain_topology_level *tl, int cpu) {struct sched_domain *sd = *per_cpu_ptr (tl->data.sd, cpu);int sd_weight; +int flags;#ifdef CONFIG_NUMA /*
@@ -5622,10 +5628,11 @@ sd_init(struct sched_domain_topology_level *tl, int cpu)#endif sd_weight =cpumask_weight (tl->info.mask (cpu)); + flags = tl->info.flags ? tl->info.flags (cpu) :0 ; -if (WARN_ONCE (tl->info.flags & ~TOPOLOGY_SD_FLAGS , +if (WARN_ONCE (flags & ~TOPOLOGY_SD_FLAGS ,"wrong flags in topology info\n" )) - tl->info.flags &= ~TOPOLOGY_SD_FLAGS ; + flags &= ~TOPOLOGY_SD_FLAGS ; *sd = (struct sched_domain ){ .min_interval = sd_weight,
@@ -5638,7 +5645,7 @@ sd_init(struct sched_domain_topology_level *tl, int cpu) | 1*SD_BALANCE_EXEC |1 *SD_BALANCE_FORK |1 *SD_WAKE_AFFINE - | tl->info.flags + | flags , .last_balance = jiffies,
Signature · 1 line
1.7.9.5
[email protected]
reviewerRFC PATCH v2 9/11 sched: provide SD_ASYM_PACKING via topology info table
In reply to [email protected]From: Dietmar Eggemann <[email protected]>
The provision of the sd topology flag SD_ASYM_PACKING is shifted from the weak function arch_sd_sibling_asym_packing() towards an arch specific topology info table.
--- arch/powerpc/kernel/smp.c | 34 +++++++++++++++++++++++++--------- kernel/sched/core.c | 13 ------------- 2 files changed, 25 insertions(+), 22 deletions(-)
arch/powerpc/kernel/smp.c +25 -9
@@ -760,6 +760,30 @@ int setup_profiling_timer(unsigned int multiplier)return 0 ; } +#ifdef CONFIG_SCHED_SMT +static inline int arch_cpu_smt_flags (int cpu) +{ +int flags =SD_SHARE_CPUPOWER |SD_SHARE_PKG_RESOURCES ; + +if (cpu_has_feature (CPU_FTR_ASYM_SMT )) { +printk_once (KERN_INFO "Enabling Asymmetric SMT scheduling\n" ); + flags |=SD_ASYM_PACKING ; + } + +return flags; +} +#endif + +static struct sched_domain_topology_info topology_info[] = { +#ifdef CONFIG_SCHED_SMT + { cpu_smt_mask, arch_cpu_smt_flags,SD_NAME (SIBLING ) }, +#endif +#ifdef CONFIG_SCHED_MC + { cpu_coregroup_mask, cpu_coregroup_flags,SD_NAME (MC ) }, +#endif + { cpu_cpu_mask,SD_NAME (CPU ) }, +}; +void __init smp_cpus_done (unsigned int max_cpus) {cpumask_var_t old_mask;
@@ -784,15 +808,7 @@ void __init smp_cpus_done(unsigned int max_cpus)dump_numa_cpu_topology (); -} - -int arch_sd_sibling_asym_packing (void ) -{ -if (cpu_has_feature (CPU_FTR_ASYM_SMT )) { -printk_once (KERN_INFO "Enabling Asymmetric SMT scheduling\n" ); -return SD_ASYM_PACKING ; - } -return 0 ; +set_sd_topology_info (topology_info,ARRAY_SIZE (topology_info)); }#ifdef CONFIG_HOTPLUG_CPU
kernel/sched/core.c +0 -13
@@ -5233,11 +5233,6 @@ static void init_sched_groups_power(int cpu, struct sched_domain *sd)atomic_set (&sg->sgp->nr_busy_cpus, sg->group_weight); } -int __weak arch_sd_sibling_asym_packing (void ) -{ -return 0 *SD_ASYM_PACKING ; -} -/* * Initializers for schedule domains * Non-inlined to reduce accumulated stack pressure in build_sched_domains()
@@ -5662,14 +5657,6 @@ sd_init(struct sched_domain_topology_level *tl, int cpu)if (sd->flags &SD_SHARE_CPUPOWER ) { sd->imbalance_pct =110 ; sd->smt_gain =1178 ;/* ~15% */ - -/* -* Call SMT specific arch topology function. -* This goes away once the powerpc arch uses -* the new interface for scheduler domain -* setup. -*/ - sd->flags |=arch_sd_sibling_asym_packing (); }else if (sd->flags &SD_SHARE_PKG_RESOURCES ) { sd->cache_nice_tries =1 ; sd->busy_idx =2 ;
Signature · 1 line
1.7.9.5
[email protected]
reviewerRFC PATCH v2 10/11 sched: delete sd ptr arg in arch_scale_freq_power()
In reply to [email protected]From: Dietmar Eggemann <[email protected]>
The ARM arch_scale_freq_power function is the only one outside the core scheduler code using struct sched_domain. This argument is not used in the call chain. This patch deletes it to make it possible to un-export struct sched_domain.
--- arch/arm/kernel/topology.c | 4 ++-- kernel/sched/fair.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-)
arch/arm/kernel/topology.c +2 -2
@@ -42,7 +42,7 @@*/ static DEFINE_PER_CPU(unsigned long, cpu_scale); -unsigned long arch_scale_freq_power (struct sched_domain *sd,int cpu) +unsigned long arch_scale_freq_power (int cpu) {return per_cpu (cpu_scale, cpu); }
@@ -166,7 +166,7 @@ void update_cpu_power(unsigned int cpu)set_power_scale (cpu,cpu_capacity (cpu) / middle_capacity);printk (KERN_INFO "CPU%u: update cpu_power %lu\n" , - cpu, arch_scale_freq_power(NULL, cpu)); + cpu, arch_scale_freq_power(cpu)); }#else
kernel/sched/fair.c +5 -5
@@ -5257,14 +5257,14 @@ static inline int get_sd_load_idx(struct sched_domain *sd,return load_idx; } -static unsigned long default_scale_freq_power (struct sched_domain *sd,int cpu) +static unsigned long default_scale_freq_power (int cpu) {return SCHED_POWER_SCALE ; } -unsigned long __weak arch_scale_freq_power (struct sched_domain *sd,int cpu) +unsigned long __weak arch_scale_freq_power (int cpu) { -return default_scale_freq_power (sd, cpu); +return default_scale_freq_power (cpu); }static unsigned long default_scale_smt_power (struct sched_domain *sd,int cpu)
@@ -5329,9 +5329,9 @@ static void update_cpu_power(struct sched_domain *sd, int cpu) sdg->sgp->power_orig = power;if (sched_feat (ARCH_POWER )) - power *=arch_scale_freq_power (sd, cpu); + power *=arch_scale_freq_power (cpu);else - power *=default_scale_freq_power (sd, cpu); + power *=default_scale_freq_power (cpu); power >>=SCHED_POWER_SHIFT ;
Signature · 1 line
1.7.9.5
[email protected]
reviewerRFC PATCH v2 11/11 sched: un-export struct sched_domain
In reply to [email protected]From: Dietmar Eggemann <[email protected]>
Since all occurrences of SD_FOO_INIT have been deleted, there is no need to export struct sched_domain any more.
--- include/linux/sched.h | 87 ---------------------------- kernel/sched/sched.h | 153 ++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 119 insertions(+), 121 deletions(-)
include/linux/sched.h +0 -87
@@ -801,93 +801,6 @@ struct sched_domain_attr {extern int sched_domain_level_max; -struct sched_group ; - -struct sched_domain { -/* These fields must be setup */ -struct sched_domain *parent;/* top domain must be null terminated */ -struct sched_domain *child;/* bottom domain must be null terminated */ -struct sched_group *groups;/* the balancing groups of the domain */ -unsigned long min_interval;/* Minimum balance interval ms */ -unsigned long max_interval;/* Maximum balance interval ms */ -unsigned int busy_factor;/* less balancing by factor if busy */ -unsigned int imbalance_pct;/* No balance until over watermark */ -unsigned int cache_nice_tries;/* Leave cache hot tasks for # tries */ -unsigned int busy_idx; -unsigned int idle_idx; -unsigned int newidle_idx; -unsigned int wake_idx; -unsigned int forkexec_idx; -unsigned int smt_gain; - -int nohz_idle;/* NOHZ IDLE status */ -int flags;/* See SD_* */ -int level; - -/* Runtime fields. */ -unsigned long last_balance;/* init to jiffies. units in jiffies */ -unsigned int balance_interval;/* initialise to 1. units in ms. */ -unsigned int nr_balance_failed;/* initialise to 0 */ - -/* idle_balance() stats */ -u64 max_newidle_lb_cost; -unsigned long next_decay_max_lb_cost; - -#ifdef CONFIG_SCHEDSTATS -/* load_balance() stats */ -unsigned int lb_count[CPU_MAX_IDLE_TYPES ]; -unsigned int lb_failed[CPU_MAX_IDLE_TYPES ]; -unsigned int lb_balanced[CPU_MAX_IDLE_TYPES ]; -unsigned int lb_imbalance[CPU_MAX_IDLE_TYPES ]; -unsigned int lb_gained[CPU_MAX_IDLE_TYPES ]; -unsigned int lb_hot_gained[CPU_MAX_IDLE_TYPES ]; -unsigned int lb_nobusyg[CPU_MAX_IDLE_TYPES ]; -unsigned int lb_nobusyq[CPU_MAX_IDLE_TYPES ]; - -/* Active load balancing */ -unsigned int alb_count; -unsigned int alb_failed; -unsigned int alb_pushed; - -/* SD_BALANCE_EXEC stats */ -unsigned int sbe_count; -unsigned int sbe_balanced; -unsigned int sbe_pushed; - -/* SD_BALANCE_FORK stats */ -unsigned int sbf_count; -unsigned int sbf_balanced; -unsigned int sbf_pushed; - -/* try_to_wake_up() stats */ -unsigned int ttwu_wake_remote; -unsigned int ttwu_move_affine; -unsigned int ttwu_move_balance; -#endif -#ifdef CONFIG_SCHED_DEBUG -char *name; -#endif -union { -void *private;/* used during construction */ -struct rcu_head rcu;/* used during destruction */ - }; - -unsigned int span_weight; -/* -* Span of all CPUs in this domain. -* -* NOTE: this field is variable length. (Allocated dynamically -* by attaching extra space to the end of the structure, -* depending on how many CPUs the kernel has booted up with) -*/ -unsigned long span[0 ]; -}; - -static inline struct cpumask *sched_domain_span (struct sched_domain *sd) -{ -return to_cpumask (sd->span); -} -extern void partition_sched_domains (int ndoms_new,cpumask_var_t doms_new[],struct sched_domain_attr *dattr_new);
kernel/sched/sched.h +119 -34
170 lines not on this page · raw message
Signature · 1 line
1.7.9.5