summaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorAndreas Herrmann <andreas.herrmann3@amd.com>2009-08-18 12:57:51 +0200
committerIngo Molnar <mingo@elte.hu>2009-08-18 18:35:42 +0200
commit0e8e85c941d8f1b43bcc2e3b8b7026cdae476c53 (patch)
tree2b9f50df17aeb9ed346a5b0c7f6ed98d38992623 /kernel/sched.c
parentsched: Separate out build of SMT sched domain from __build_sched_domains (diff)
downloadlinux-0e8e85c941d8f1b43bcc2e3b8b7026cdae476c53.tar.xz
linux-0e8e85c941d8f1b43bcc2e3b8b7026cdae476c53.zip
sched: Separate out build of SMT sched groups from __build_sched_domains
... to further strip down __build_sched_domains(). Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com> Cc: Peter Zijlstra <peterz@infradead.org> LKML-Reference: <20090818105751.GH29515@alberich.amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 2ecec06e3f0c..43cfc6e54e96 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -8563,6 +8563,25 @@ static struct sched_domain *__build_smt_sched_domain(struct s_data *d,
return sd;
}
+static void build_sched_groups(struct s_data *d, enum sched_domain_level l,
+ const struct cpumask *cpu_map, int cpu)
+{
+ switch (l) {
+#ifdef CONFIG_SCHED_SMT
+ case SD_LV_SIBLING: /* set up CPU (sibling) groups */
+ cpumask_and(d->this_sibling_map, cpu_map,
+ topology_thread_cpumask(cpu));
+ if (cpu == cpumask_first(d->this_sibling_map))
+ init_sched_build_groups(d->this_sibling_map, cpu_map,
+ &cpu_to_cpu_group,
+ d->send_covered, d->tmpmask);
+ break;
+#endif
+ default:
+ break;
+ }
+}
+
/*
* Build sched domains for a given set of cpus and attach the sched domains
* to the individual cpus
@@ -8597,19 +8616,9 @@ static int __build_sched_domains(const struct cpumask *cpu_map,
sd = __build_smt_sched_domain(&d, cpu_map, attr, sd, i);
}
-#ifdef CONFIG_SCHED_SMT
- /* Set up CPU (sibling) groups */
for_each_cpu(i, cpu_map) {
- cpumask_and(d.this_sibling_map,
- topology_thread_cpumask(i), cpu_map);
- if (i != cpumask_first(d.this_sibling_map))
- continue;
-
- init_sched_build_groups(d.this_sibling_map, cpu_map,
- &cpu_to_cpu_group,
- d.send_covered, d.tmpmask);
+ build_sched_groups(&d, SD_LV_SIBLING, cpu_map, i);
}
-#endif
#ifdef CONFIG_SCHED_MC
/* Set up multi-core groups */