[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1449478184-27168-3-git-send-email-mingo@kernel.org>
Date: Mon, 7 Dec 2015 09:49:42 +0100
From: Ingo Molnar <mingo@...nel.org>
To: linux-kernel@...r.kernel.org
Cc: Rusty Russell <rusty@...tcorp.com.au>,
Peter Zijlstra <peterz@...radead.org>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Xunlei Pang <xlpang@...hat.com>,
Rik van Riel <riel@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>
Subject: [PATCH 2/4] cpumask: Remove 'alloc_cpumask_var()'
This API is unused and slightly unrobust: on non-CPUMASK_OFFSTACK
kernels it will result in initialized cpumasks - while on
CPUMASK_OFFSTACK kernels it results in initialized cpumasks,
enabling hard to find initialization bugs.
Be conservative and default to zeroing. Users of this facility that
really want to allocate their cpumasks without initializing them can
still use alloc_cpumask_var_node() to do so.
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
include/linux/cpumask.h | 6 ------
lib/cpumask.c | 13 ++++---------
2 files changed, 4 insertions(+), 15 deletions(-)
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 608beca04fc6..0d24286fe8f8 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -654,7 +654,6 @@ typedef struct cpumask *cpumask_var_t;
#define this_cpu_cpumask_var_ptr(x) this_cpu_read(x)
bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node);
-bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags);
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);
@@ -666,11 +665,6 @@ typedef struct cpumask cpumask_var_t[1];
#define this_cpu_cpumask_var_ptr(x) this_cpu_ptr(x)
-static inline bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
-{
- return true;
-}
-
static inline bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags,
int node)
{
diff --git a/lib/cpumask.c b/lib/cpumask.c
index 7f93df07bce7..415041e9cda6 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -80,24 +80,19 @@ bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node)
EXPORT_SYMBOL(zalloc_cpumask_var_node);
/**
- * alloc_cpumask_var - allocate a struct cpumask
+ * zalloc_cpumask_var - allocate a struct cpumask
* @mask: pointer to cpumask_var_t where the cpumask is returned
* @flags: GFP_ flags
*
* Only defined when CONFIG_CPUMASK_OFFSTACK=y, otherwise is
* a nop returning a constant 1 (in <linux/cpumask.h>).
+ * The cpumask is initialized to all zeroes.
*
- * See alloc_cpumask_var_node.
+ * See alloc_cpumask_var_node().
*/
-bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
-{
- return alloc_cpumask_var_node(mask, flags, NUMA_NO_NODE);
-}
-EXPORT_SYMBOL(alloc_cpumask_var);
-
bool zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
{
- return alloc_cpumask_var(mask, flags | __GFP_ZERO);
+ return alloc_cpumask_var_node(mask, flags | __GFP_ZERO, NUMA_NO_NODE);
}
EXPORT_SYMBOL(zalloc_cpumask_var);
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists