aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched/core.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2013-06-04 06:11:15 -0400
committerIngo Molnar <mingo@kernel.org>2013-06-19 06:58:43 -0400
commit22da956953f371c1ee7a578c31ed8c5702cb52b1 (patch)
tree3b50759bd7e0a269c1db2f2b018c96107fc72e13 /kernel/sched/core.c
parent4a850cbefa9592ddde3670a41c10c9576a657c43 (diff)
sched: Optimize build_sched_domains() for saving first SD node for a cpu
We are saving first scheduling domain for a cpu in build_sched_domains() by iterating over the nested sd->child list. We don't actually need to do it this way. tl will be equal to sched_domain_topology for the first iteration and so we can set *per_cpu_ptr(d.sd, i) based on that. So, save pointer to first SD while running the iteration loop over tl's. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/fc473527cbc4dfa0b8eeef2a59db74684eb59a83.1370436120.git.viresh.kumar@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched/core.c')
-rw-r--r--kernel/sched/core.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 342e74419f8f..137dcc03f66d 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5985,16 +5985,13 @@ static int build_sched_domains(const struct cpumask *cpu_map,
5985 sd = NULL; 5985 sd = NULL;
5986 for (tl = sched_domain_topology; tl->init; tl++) { 5986 for (tl = sched_domain_topology; tl->init; tl++) {
5987 sd = build_sched_domain(tl, cpu_map, attr, sd, i); 5987 sd = build_sched_domain(tl, cpu_map, attr, sd, i);
5988 if (tl == sched_domain_topology)
5989 *per_cpu_ptr(d.sd, i) = sd;
5988 if (tl->flags & SDTL_OVERLAP || sched_feat(FORCE_SD_OVERLAP)) 5990 if (tl->flags & SDTL_OVERLAP || sched_feat(FORCE_SD_OVERLAP))
5989 sd->flags |= SD_OVERLAP; 5991 sd->flags |= SD_OVERLAP;
5990 if (cpumask_equal(cpu_map, sched_domain_span(sd))) 5992 if (cpumask_equal(cpu_map, sched_domain_span(sd)))
5991 break; 5993 break;
5992 } 5994 }
5993
5994 while (sd->child)
5995 sd = sd->child;
5996
5997 *per_cpu_ptr(d.sd, i) = sd;
5998 } 5995 }
5999 5996
6000 /* Build the groups for the domains */ 5997 /* Build the groups for the domains */