The patch titled sched: introduce child field in sched_domain has been added to the -mm tree. Its filename is sched-introduce-child-field-in-sched_domain.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: sched: introduce child field in sched_domain From: "Siddha, Suresh B" <suresh.b.siddha@xxxxxxxxx> Introduce the child field in sched_domain struct and use it in sched_balance_self(). We will also use this field in cleaning up the sched group cpu_power setup(done in a different patch) code. Signed-off-by: Suresh Siddha <suresh.b.siddha@xxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxx> Acked-by: Nick Piggin <nickpiggin@xxxxxxxxxxxx> Cc: Paul Jackson <pj@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- include/asm-i386/topology.h | 1 include/asm-ia64/topology.h | 2 + include/asm-mips/mach-ip27/topology.h | 1 include/asm-powerpc/topology.h | 1 include/asm-x86_64/topology.h | 1 include/linux/sched.h | 1 include/linux/topology.h | 3 + kernel/sched.c | 40 ++++++++++++++++++------ 8 files changed, 40 insertions(+), 10 deletions(-) diff -puN include/asm-i386/topology.h~sched-introduce-child-field-in-sched_domain include/asm-i386/topology.h --- a/include/asm-i386/topology.h~sched-introduce-child-field-in-sched_domain +++ a/include/asm-i386/topology.h @@ -74,6 +74,7 @@ static inline int node_to_first_cpu(int #define SD_NODE_INIT (struct sched_domain) { \ .span = CPU_MASK_NONE, \ .parent = NULL, \ + .child = NULL, \ .groups = NULL, \ .min_interval = 8, \ .max_interval = 32, \ diff -puN include/asm-ia64/topology.h~sched-introduce-child-field-in-sched_domain include/asm-ia64/topology.h --- a/include/asm-ia64/topology.h~sched-introduce-child-field-in-sched_domain +++ a/include/asm-ia64/topology.h @@ -59,6 +59,7 @@ void build_cpu_to_node_map(void); #define SD_CPU_INIT (struct sched_domain) { \ .span = CPU_MASK_NONE, \ .parent = NULL, \ + .child = NULL, \ .groups = NULL, \ .min_interval = 1, \ .max_interval = 4, \ @@ -84,6 +85,7 @@ void build_cpu_to_node_map(void); #define SD_NODE_INIT (struct sched_domain) { \ .span = CPU_MASK_NONE, \ .parent = NULL, \ + .child = NULL, \ .groups = NULL, \ .min_interval = 8, \ .max_interval = 8*(min(num_online_cpus(), 32)), \ diff -puN include/asm-mips/mach-ip27/topology.h~sched-introduce-child-field-in-sched_domain include/asm-mips/mach-ip27/topology.h --- a/include/asm-mips/mach-ip27/topology.h~sched-introduce-child-field-in-sched_domain +++ a/include/asm-mips/mach-ip27/topology.h @@ -22,6 +22,7 @@ extern unsigned char __node_distances[MA #define SD_NODE_INIT (struct sched_domain) { \ .span = CPU_MASK_NONE, \ .parent = NULL, \ + .child = NULL, \ .groups = NULL, \ .min_interval = 8, \ .max_interval = 32, \ diff -puN include/asm-powerpc/topology.h~sched-introduce-child-field-in-sched_domain include/asm-powerpc/topology.h --- a/include/asm-powerpc/topology.h~sched-introduce-child-field-in-sched_domain +++ a/include/asm-powerpc/topology.h @@ -43,6 +43,7 @@ extern int pcibus_to_node(struct pci_bus #define SD_NODE_INIT (struct sched_domain) { \ .span = CPU_MASK_NONE, \ .parent = NULL, \ + .child = NULL, \ .groups = NULL, \ .min_interval = 8, \ .max_interval = 32, \ diff -puN include/asm-x86_64/topology.h~sched-introduce-child-field-in-sched_domain include/asm-x86_64/topology.h --- a/include/asm-x86_64/topology.h~sched-introduce-child-field-in-sched_domain +++ a/include/asm-x86_64/topology.h @@ -31,6 +31,7 @@ extern int __node_distance(int, int); #define SD_NODE_INIT (struct sched_domain) { \ .span = CPU_MASK_NONE, \ .parent = NULL, \ + .child = NULL, \ .groups = NULL, \ .min_interval = 8, \ .max_interval = 32, \ diff -puN include/linux/sched.h~sched-introduce-child-field-in-sched_domain include/linux/sched.h --- a/include/linux/sched.h~sched-introduce-child-field-in-sched_domain +++ a/include/linux/sched.h @@ -645,6 +645,7 @@ 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 */ cpumask_t span; /* span of all CPUs in this domain */ unsigned long min_interval; /* Minimum balance interval ms */ diff -puN include/linux/topology.h~sched-introduce-child-field-in-sched_domain include/linux/topology.h --- a/include/linux/topology.h~sched-introduce-child-field-in-sched_domain +++ a/include/linux/topology.h @@ -89,6 +89,7 @@ #define SD_SIBLING_INIT (struct sched_domain) { \ .span = CPU_MASK_NONE, \ .parent = NULL, \ + .child = NULL, \ .groups = NULL, \ .min_interval = 1, \ .max_interval = 2, \ @@ -119,6 +120,7 @@ #define SD_CPU_INIT (struct sched_domain) { \ .span = CPU_MASK_NONE, \ .parent = NULL, \ + .child = NULL, \ .groups = NULL, \ .min_interval = 1, \ .max_interval = 4, \ @@ -146,6 +148,7 @@ #define SD_ALLNODES_INIT (struct sched_domain) { \ .span = CPU_MASK_NONE, \ .parent = NULL, \ + .child = NULL, \ .groups = NULL, \ .min_interval = 64, \ .max_interval = 64*num_online_cpus(), \ diff -puN kernel/sched.c~sched-introduce-child-field-in-sched_domain kernel/sched.c --- a/kernel/sched.c~sched-introduce-child-field-in-sched_domain +++ a/kernel/sched.c @@ -1286,21 +1286,29 @@ static int sched_balance_self(int cpu, i while (sd) { cpumask_t span; struct sched_group *group; - int new_cpu; - int weight; + int new_cpu, weight; + + if (!(sd->flags & flag)) { + sd = sd->child; + continue; + } span = sd->span; group = find_idlest_group(sd, t, cpu); - if (!group) - goto nextlevel; + if (!group) { + sd = sd->child; + continue; + } new_cpu = find_idlest_cpu(group, t, cpu); - if (new_cpu == -1 || new_cpu == cpu) - goto nextlevel; + if (new_cpu == -1 || new_cpu == cpu) { + /* Now try balancing at a lower domain level of cpu */ + sd = sd->child; + continue; + } - /* Now try balancing at a lower domain level */ + /* Now try balancing at a lower domain level of new_cpu */ cpu = new_cpu; -nextlevel: sd = NULL; weight = cpus_weight(span); for_each_domain(cpu, tmp) { @@ -5447,12 +5455,18 @@ static void cpu_attach_domain(struct sch struct sched_domain *parent = tmp->parent; if (!parent) break; - if (sd_parent_degenerate(tmp, parent)) + if (sd_parent_degenerate(tmp, parent)) { tmp->parent = parent->parent; + if (parent->parent) + parent->parent->child = tmp; + } } - if (sd && sd_degenerate(sd)) + if (sd && sd_degenerate(sd)) { sd = sd->parent; + if (sd) + sd->child = NULL; + } sched_domain_debug(sd, cpu); @@ -6287,6 +6301,8 @@ static int build_sched_domains(const cpu *sd = SD_NODE_INIT; sd->span = sched_domain_node_span(cpu_to_node(i)); sd->parent = p; + if (p) + p->child = sd; cpus_and(sd->span, sd->span, *cpu_map); #endif @@ -6296,6 +6312,8 @@ static int build_sched_domains(const cpu *sd = SD_CPU_INIT; sd->span = nodemask; sd->parent = p; + if (p) + p->child = sd; sd->groups = &sched_group_phys[group]; #ifdef CONFIG_SCHED_MC @@ -6306,6 +6324,7 @@ static int build_sched_domains(const cpu sd->span = cpu_coregroup_map(i); cpus_and(sd->span, sd->span, *cpu_map); sd->parent = p; + p->child = sd; sd->groups = &sched_group_core[group]; #endif @@ -6317,6 +6336,7 @@ static int build_sched_domains(const cpu sd->span = cpu_sibling_map[i]; cpus_and(sd->span, sd->span, *cpu_map); sd->parent = p; + p->child = sd; sd->groups = &sched_group_cpus[group]; #endif } _ Patches currently in -mm which might be from suresh.b.siddha@xxxxxxxxx are fix-longstanding-load-balancing-bug-in-the-scheduler.patch fix-potential-stack-overflow-in-mm-slabc.patch sched-remove-unnecessary-sched-group-allocations.patch sched-remove-unnecessary-sched-group-allocations-fix.patch sched-introduce-child-field-in-sched_domain.patch sched-cleanup-sched_group-cpu_power-setup.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html