Commit 27723a68 authored by Viresh Kumar's avatar Viresh Kumar Committed by Ingo Molnar

sched: Create for_each_sd_topology()

For loop for traversing sched_domain_topology was used at multiple placed in
core.c. This patch removes code redundancy by creating for_each_sd_topology().
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/e0e04542f54e9464bd9da54f5ccfe62ec6c4c0bc.1370861520.git.viresh.kumar@linaro.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent c75e0128
...@@ -5565,6 +5565,9 @@ static struct sched_domain_topology_level default_topology[] = { ...@@ -5565,6 +5565,9 @@ static struct sched_domain_topology_level default_topology[] = {
static struct sched_domain_topology_level *sched_domain_topology = default_topology; static struct sched_domain_topology_level *sched_domain_topology = default_topology;
#define for_each_sd_topology(tl) \
for (tl = sched_domain_topology; tl->init; tl++)
#ifdef CONFIG_NUMA #ifdef CONFIG_NUMA
static int sched_domains_numa_levels; static int sched_domains_numa_levels;
...@@ -5862,7 +5865,7 @@ static int __sdt_alloc(const struct cpumask *cpu_map) ...@@ -5862,7 +5865,7 @@ static int __sdt_alloc(const struct cpumask *cpu_map)
struct sched_domain_topology_level *tl; struct sched_domain_topology_level *tl;
int j; int j;
for (tl = sched_domain_topology; tl->init; tl++) { for_each_sd_topology(tl) {
struct sd_data *sdd = &tl->data; struct sd_data *sdd = &tl->data;
sdd->sd = alloc_percpu(struct sched_domain *); sdd->sd = alloc_percpu(struct sched_domain *);
...@@ -5915,7 +5918,7 @@ static void __sdt_free(const struct cpumask *cpu_map) ...@@ -5915,7 +5918,7 @@ static void __sdt_free(const struct cpumask *cpu_map)
struct sched_domain_topology_level *tl; struct sched_domain_topology_level *tl;
int j; int j;
for (tl = sched_domain_topology; tl->init; tl++) { for_each_sd_topology(tl) {
struct sd_data *sdd = &tl->data; struct sd_data *sdd = &tl->data;
for_each_cpu(j, cpu_map) { for_each_cpu(j, cpu_map) {
...@@ -5983,7 +5986,7 @@ static int build_sched_domains(const struct cpumask *cpu_map, ...@@ -5983,7 +5986,7 @@ static int build_sched_domains(const struct cpumask *cpu_map,
struct sched_domain_topology_level *tl; struct sched_domain_topology_level *tl;
sd = NULL; sd = NULL;
for (tl = sched_domain_topology; tl->init; tl++) { for_each_sd_topology(tl) {
sd = build_sched_domain(tl, cpu_map, attr, sd, i); sd = build_sched_domain(tl, cpu_map, attr, sd, i);
if (tl == sched_domain_topology) if (tl == sched_domain_topology)
*per_cpu_ptr(d.sd, i) = sd; *per_cpu_ptr(d.sd, i) = sd;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment