Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755024AbbLGIuQ (ORCPT ); Mon, 7 Dec 2015 03:50:16 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:36533 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753844AbbLGIuM (ORCPT ); Mon, 7 Dec 2015 03:50:12 -0500 From: Ingo Molnar To: linux-kernel@vger.kernel.org Cc: Rusty Russell , Peter Zijlstra , Sergey Senozhatsky , Xunlei Pang , Rik van Riel , Andrew Morton , Linus Torvalds , Thomas Gleixner Subject: [PATCH 4/4] cpumask: Rename 'alloc_cpumask_var_node()' to '__alloc_cpumask_var_node()' Date: Mon, 7 Dec 2015 09:49:44 +0100 Message-Id: <1449478184-27168-5-git-send-email-mingo@kernel.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1449478184-27168-1-git-send-email-mingo@kernel.org> References: <1449478184-27168-1-git-send-email-mingo@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3903 Lines: 99 Add a double underscore to this API, to make it very clear that this is an internal API with unusual semantics: for example on !CPUMASK_OFFSTACK kernels it will result in initialized cpumasks, while on CPUMASK_OFFSTACK kernels it will allocate a var-cpumask that is not initialized. The caller has to make sure this initialization happens. Also add this information to the documentation of the API. Signed-off-by: Ingo Molnar --- include/linux/cpumask.h | 4 ++-- lib/cpumask.c | 16 ++++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 719fecaa64e4..7ed1e1f8e806 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -653,7 +653,7 @@ 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_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 zalloc_bootmem_cpumask_var(cpumask_var_t *mask); @@ -665,7 +665,7 @@ typedef struct cpumask cpumask_var_t[1]; #define this_cpu_cpumask_var_ptr(x) this_cpu_ptr(x) -static inline bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, +static inline bool __alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node) { return true; diff --git a/lib/cpumask.c b/lib/cpumask.c index cb9b80284274..c291d993fb9c 100644 --- a/lib/cpumask.c +++ b/lib/cpumask.c @@ -45,7 +45,7 @@ int cpumask_any_but(const struct cpumask *mask, unsigned int cpu) /* These are not inline because of header tangles. */ #ifdef CONFIG_CPUMASK_OFFSTACK /** - * alloc_cpumask_var_node - allocate a struct cpumask on a given node + * __alloc_cpumask_var_node - allocate a struct cpumask on a given node * @mask: pointer to cpumask_var_t where the cpumask is returned * @flags: GFP_ flags * @@ -57,8 +57,12 @@ int cpumask_any_but(const struct cpumask *mask, unsigned int cpu) * usually smart enough to know that mask can never be NULL if * CONFIG_CPUMASK_OFFSTACK=n, so does code elimination in that case * too. + * + * ( Also note that the freshly allocated mask will not be zero + * initialized - in contrast to !CONFIG_CPUMASK_OFFSTACK kernels + * which typically pass in masks that are already initialized. ) */ -bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node) +bool __alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node) { *mask = kmalloc_node(cpumask_size(), flags, node); @@ -71,11 +75,11 @@ bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node) return *mask != NULL; } -EXPORT_SYMBOL(alloc_cpumask_var_node); +EXPORT_SYMBOL(__alloc_cpumask_var_node); bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node) { - return alloc_cpumask_var_node(mask, flags | __GFP_ZERO, node); + return __alloc_cpumask_var_node(mask, flags | __GFP_ZERO, node); } EXPORT_SYMBOL(zalloc_cpumask_var_node); @@ -88,11 +92,11 @@ EXPORT_SYMBOL(zalloc_cpumask_var_node); * a nop returning a constant 1 (in ). * The cpumask is initialized to all zeroes. * - * See alloc_cpumask_var_node(). + * See __alloc_cpumask_var_node(). */ bool zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) { - return alloc_cpumask_var_node(mask, flags | __GFP_ZERO, NUMA_NO_NODE); + 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/