[PATCH 3/4] cpumask: Rename 'alloc_bootmem_cpumask_var()' to 'zalloc_bootmem_cpumask_var()'

From: Ingo Molnar
Date: Mon Dec 07 2015 - 03:50:25 EST


This API is somewhat confusingly named 'alloc', despite returning zeroed
cpumasks. Rename it to 'zalloc' to be in line with usual terminology.

Bootmem allocations are always zero initialized.

(Also fix a typo in a comment of this API while at it.)

Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
---
arch/powerpc/mm/numa.c | 2 +-
arch/powerpc/platforms/pseries/smp.c | 2 +-
arch/x86/kernel/cpu/common.c | 8 ++++----
arch/x86/mm/numa.c | 2 +-
include/linux/cpumask.h | 4 ++--
kernel/rcu/tree_plugin.h | 2 +-
kernel/sched/core.c | 2 +-
kernel/time/tick-sched.c | 2 +-
lib/cpumask.c | 6 +++---
9 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 669a15e7fa76..762f7ea55e78 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -81,7 +81,7 @@ static void __init setup_node_to_cpumask_map(void)

/* allocate the map */
for_each_node(node)
- alloc_bootmem_cpumask_var(&node_to_cpumask_map[node]);
+ zalloc_bootmem_cpumask_var(&node_to_cpumask_map[node]);

/* cpumask_of_node() will now work */
dbg("Node to cpumask map for %d nodes\n", nr_node_ids);
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index 6932ea803e33..f22944b8033b 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -230,7 +230,7 @@ static void __init smp_init_pseries(void)

pr_debug(" -> smp_init_pSeries()\n");

- alloc_bootmem_cpumask_var(&of_spin_mask);
+ zalloc_bootmem_cpumask_var(&of_spin_mask);

/*
* Mark threads which are still spinning in hold loops
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 105da8df87ae..a9f43c4d9c28 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -61,10 +61,10 @@ cpumask_var_t cpu_sibling_setup_mask;
/* correctly size the local cpu masks */
void __init setup_cpu_local_masks(void)
{
- alloc_bootmem_cpumask_var(&cpu_initialized_mask);
- alloc_bootmem_cpumask_var(&cpu_callin_mask);
- alloc_bootmem_cpumask_var(&cpu_callout_mask);
- alloc_bootmem_cpumask_var(&cpu_sibling_setup_mask);
+ zalloc_bootmem_cpumask_var(&cpu_initialized_mask);
+ zalloc_bootmem_cpumask_var(&cpu_callin_mask);
+ zalloc_bootmem_cpumask_var(&cpu_callout_mask);
+ zalloc_bootmem_cpumask_var(&cpu_sibling_setup_mask);
}

static void default_init(struct cpuinfo_x86 *c)
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index c3b3f653ed0c..8f2875f4b854 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -122,7 +122,7 @@ void __init setup_node_to_cpumask_map(void)

/* allocate the map */
for (node = 0; node < nr_node_ids; node++)
- alloc_bootmem_cpumask_var(&node_to_cpumask_map[node]);
+ zalloc_bootmem_cpumask_var(&node_to_cpumask_map[node]);

/* cpumask_of_node() will now work */
pr_debug("Node to cpumask map for %d nodes\n", nr_node_ids);
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 0d24286fe8f8..719fecaa64e4 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -656,7 +656,7 @@ typedef struct cpumask *cpumask_var_t;
bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node);
bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node);
bool zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags);
-void alloc_bootmem_cpumask_var(cpumask_var_t *mask);
+void zalloc_bootmem_cpumask_var(cpumask_var_t *mask);
void free_cpumask_var(cpumask_var_t mask);
void free_bootmem_cpumask_var(cpumask_var_t mask);

@@ -684,7 +684,7 @@ static inline bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags,
return true;
}

-static inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask)
+static inline void zalloc_bootmem_cpumask_var(cpumask_var_t *mask)
{
}

diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 630c19772630..2fc158fa07a1 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -1804,7 +1804,7 @@ static void increment_cpu_stall_ticks(void)
/* Parse the boot-time rcu_nocb_mask CPU list from the kernel parameters. */
static int __init rcu_nocb_setup(char *str)
{
- alloc_bootmem_cpumask_var(&rcu_nocb_mask);
+ zalloc_bootmem_cpumask_var(&rcu_nocb_mask);
have_rcu_nocb_mask = true;
cpulist_parse(str, rcu_nocb_mask);
return 1;
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index aa7f8e965386..d57eeb6df663 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6171,7 +6171,7 @@ cpu_attach_domain(struct sched_domain *sd, struct root_domain *rd, int cpu)
/* Setup the mask of cpus configured for isolated domains */
static int __init isolated_cpu_setup(char *str)
{
- alloc_bootmem_cpumask_var(&cpu_isolated_map);
+ zalloc_bootmem_cpumask_var(&cpu_isolated_map);
cpulist_parse(str, cpu_isolated_map);
return 1;
}
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index b6cf842440c8..94e56927c79e 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -277,7 +277,7 @@ void __tick_nohz_task_switch(void)
/* Parse the boot-time nohz CPU list from the kernel parameters. */
static int __init tick_nohz_full_setup(char *str)
{
- alloc_bootmem_cpumask_var(&tick_nohz_full_mask);
+ zalloc_bootmem_cpumask_var(&tick_nohz_full_mask);
if (cpulist_parse(str, tick_nohz_full_mask) < 0) {
pr_warning("NOHZ: Incorrect nohz_full cpumask\n");
free_bootmem_cpumask_var(tick_nohz_full_mask);
diff --git a/lib/cpumask.c b/lib/cpumask.c
index 415041e9cda6..cb9b80284274 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -97,7 +97,7 @@ bool zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
EXPORT_SYMBOL(zalloc_cpumask_var);

/**
- * alloc_bootmem_cpumask_var - allocate a struct cpumask from the bootmem arena.
+ * zalloc_bootmem_cpumask_var - allocate a struct cpumask from bootmem.
* @mask: pointer to cpumask_var_t where the cpumask is returned
*
* Only defined when CONFIG_CPUMASK_OFFSTACK=y, otherwise is
@@ -105,7 +105,7 @@ EXPORT_SYMBOL(zalloc_cpumask_var);
* Either returns an allocated (zero-filled) cpumask, or causes the
* system to panic.
*/
-void __init alloc_bootmem_cpumask_var(cpumask_var_t *mask)
+void __init zalloc_bootmem_cpumask_var(cpumask_var_t *mask)
{
*mask = memblock_virt_alloc(cpumask_size(), 0);
}
@@ -123,7 +123,7 @@ void free_cpumask_var(cpumask_var_t mask)
EXPORT_SYMBOL(free_cpumask_var);

/**
- * free_bootmem_cpumask_var - frees result of alloc_bootmem_cpumask_var
+ * free_bootmem_cpumask_var - frees result of zalloc_bootmem_cpumask_var
* @mask: cpumask to free
*/
void __init free_bootmem_cpumask_var(cpumask_var_t mask)
--
2.5.0

--
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/