Peter/Ingo,
These are minor fixes that I could find for code responsible for creating sched domains. They are rebased of my earlier fixes:
https://lkml.org/lkml/2013/6/4/253
I couldn't find them in linux-next or tip/master and so giving this link.
Viresh Kumar (3): sched: don't initialize alloc_state in build_sched_domains sched: don't sd->child to NULL when it is already NULL sched: Create for_each_sd_topology()
kernel/sched/core.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
alloc_state will be overwritten by __visit_domain_allocation_hell() and so we don't actually need to initialize alloc_state.
Signed-off-by: Viresh Kumar viresh.kumar@linaro.org --- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 0623703..5faa748 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5956,7 +5956,7 @@ struct sched_domain *build_sched_domain(struct sched_domain_topology_level *tl, static int build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *attr) { - enum s_alloc alloc_state = sa_none; + enum s_alloc alloc_state; struct sched_domain *sd; struct s_data d; int i, ret = -ENOMEM;
Memory for sd is allocated with kzalloc_node() which will initialize its fields with zero. In build_sched_domain() we are setting sd->child to child even if child is NULL, which isn't required.
Lets do it only if child isn't NULL.
Signed-off-by: Viresh Kumar viresh.kumar@linaro.org --- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 5faa748..a12113d 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5942,8 +5942,8 @@ struct sched_domain *build_sched_domain(struct sched_domain_topology_level *tl, sd->level = child->level + 1; sched_domain_level_max = max(sched_domain_level_max, sd->level); child->parent = sd; + sd->child = child; } - sd->child = child; set_domain_attribute(sd, attr);
return sd;
On 10 June 2013 16:27, Viresh Kumar viresh.kumar@linaro.org wrote:
Yes subject should be: sched: don't set sd->child to NULL when it is already NULL
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: Viresh Kumar viresh.kumar@linaro.org --- kernel/sched/core.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index a12113d..e585e10 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5552,6 +5552,9 @@ static struct sched_domain_topology_level 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
static int sched_domains_numa_levels; @@ -5849,7 +5852,7 @@ static int __sdt_alloc(const struct cpumask *cpu_map) struct sched_domain_topology_level *tl; int j;
- for (tl = sched_domain_topology; tl->init; tl++) { + for_each_sd_topology(tl) { struct sd_data *sdd = &tl->data;
sdd->sd = alloc_percpu(struct sched_domain *); @@ -5902,7 +5905,7 @@ static void __sdt_free(const struct cpumask *cpu_map) struct sched_domain_topology_level *tl; int j;
- for (tl = sched_domain_topology; tl->init; tl++) { + for_each_sd_topology(tl) { struct sd_data *sdd = &tl->data;
for_each_cpu(j, cpu_map) { @@ -5970,7 +5973,7 @@ static int build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_topology_level *tl;
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); if (tl == sched_domain_topology) *per_cpu_ptr(d.sd, i) = sd;
On Mon, Jun 10, 2013 at 04:27:17PM +0530, Viresh Kumar wrote:
Peter/Ingo,
These are minor fixes that I could find for code responsible for creating sched domains. They are rebased of my earlier fixes:
https://lkml.org/lkml/2013/6/4/253
I couldn't find them in linux-next or tip/master and so giving this link.
Viresh Kumar (3): sched: don't initialize alloc_state in build_sched_domains sched: don't sd->child to NULL when it is already NULL sched: Create for_each_sd_topology()
kernel/sched/core.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
Thanks!
linaro-kernel@lists.linaro.org