@@ -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
@@ -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,