[RFC][PATCH 13/14] sched: Remove nodemask allocation

From: Peter Zijlstra
Date: Mon Mar 14 2011 - 11:29:09 EST


There's only one nodemask user left so remove it with a direct
computation and save some memory and reduce some code-flow
complexity.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
LKML-Reference: <new-submission>
---
kernel/sched.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)

Index: linux-2.6/kernel/sched.c
===================================================================
--- linux-2.6.orig/kernel/sched.c
+++ linux-2.6/kernel/sched.c
@@ -6814,7 +6814,6 @@ struct sd_data {
};

struct s_data {
- cpumask_var_t nodemask;
cpumask_var_t send_covered;
struct sched_domain ** __percpu sd;
struct sd_data sdd[SD_LV_MAX];
@@ -6826,7 +6825,6 @@ enum s_alloc {
sa_sd,
sa_sd_storage,
sa_send_covered,
- sa_nodemask,
sa_none,
};

@@ -7011,8 +7009,6 @@ static void __free_domain_allocs(struct
} /* fall through */
case sa_send_covered:
free_cpumask_var(d->send_covered); /* fall through */
- case sa_nodemask:
- free_cpumask_var(d->nodemask); /* fall through */
case sa_none:
break;
}
@@ -7025,10 +7021,8 @@ static enum s_alloc __visit_domain_alloc

memset(d, 0, sizeof(*d));

- if (!alloc_cpumask_var(&d->nodemask, GFP_KERNEL))
- return sa_none;
if (!alloc_cpumask_var(&d->send_covered, GFP_KERNEL))
- return sa_nodemask;
+ return sa_none;
for (i = 0; i < SD_LV_MAX; i++) {
d->sdd[i].sd = alloc_percpu(struct sched_domain *);
if (!d->sdd[i].sd)
@@ -7125,7 +7119,8 @@ static struct sched_domain *__build_cpu_
struct sched_domain *sd;
sd = sd_init_CPU(d, i);
set_domain_attribute(sd, attr);
- cpumask_copy(sched_domain_span(sd), d->nodemask);
+ cpumask_and(sched_domain_span(sd),
+ cpumask_of_node(cpu_to_node(i)), cpu_map);
sd->parent = parent;
if (parent)
parent->child = sd;
@@ -7195,9 +7190,6 @@ static int __build_sched_domains(const s

/* Set up domains for cpus specified by the cpu_map. */
for_each_cpu(i, cpu_map) {
- cpumask_and(d.nodemask, cpumask_of_node(cpu_to_node(i)),
- cpu_map);
-
sd = NULL;
sd = __build_allnodes_sched_domain(&d, cpu_map, attr, sd, i);
sd = __build_node_sched_domain(&d, cpu_map, attr, sd, i);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/