Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755207AbbLGIu4 (ORCPT ); Mon, 7 Dec 2015 03:50:56 -0500 Received: from mail-wm0-f53.google.com ([74.125.82.53]:34415 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754738AbbLGIuJ (ORCPT ); Mon, 7 Dec 2015 03:50:09 -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 2/4] cpumask: Remove 'alloc_cpumask_var()' Date: Mon, 7 Dec 2015 09:49:42 +0100 Message-Id: <1449478184-27168-3-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: 2852 Lines: 80 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 --- 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 ). + * 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/