From patchwork Wed Jul 6 17:42:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 12908429 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F994C43334 for ; Wed, 6 Jul 2022 17:43:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E38936B0082; Wed, 6 Jul 2022 13:43:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DC1556B0083; Wed, 6 Jul 2022 13:43:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C3BA26B0085; Wed, 6 Jul 2022 13:43:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id B02DE6B0082 for ; Wed, 6 Jul 2022 13:43:09 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 8FE9E337A2 for ; Wed, 6 Jul 2022 17:43:09 +0000 (UTC) X-FDA: 79657396098.21.FD56D5F Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) by imf24.hostedemail.com (Postfix) with ESMTP id 2E3F5180030 for ; Wed, 6 Jul 2022 17:43:09 +0000 (UTC) Received: by mail-qt1-f179.google.com with SMTP id r2so19256463qta.0 for ; Wed, 06 Jul 2022 10:43:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yfeDuyRYNoVK5OuNHYtPJI0+qGNG77BF8q+9jUECqCA=; b=k+hw5BFlf7mL7dQoYsqsOVto8IsXSzSQEDJE/tC5hTf1lqeb3BMECvvjJCW6bwePV1 ckL/HbfUQC5aWcsdRq9+Q49oKYYnRnxKhZvHOnI2vBvNzs1mcXZGcIe9/pY8KerEmTCE Cl3SwHrWiru7RFqlHB6bItSpCSENPIVaLiVrPMha3FjFswNagqp9KsYtv5Q7z57nlCHM Km4CpS4NBXzO4cGWIgxODzB3vaadiNCjFi7jBEHIV3XpOdlx2CtCrwUpn8ttbtT//C6l 7Xw3+indiZaDKs3WYOy7bUugUGAuZodOL+uvzYv1DU8OYoClITXJPknBdYJOjfWMqv1J gybw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yfeDuyRYNoVK5OuNHYtPJI0+qGNG77BF8q+9jUECqCA=; b=k6UwN61n5v+QFhAjcdrvIqssasrpRCXMh4mrwNpC+AdxMoA9PJ598ld/ia2PeJCn+k yt1ki0mbEB0HfgK/IjyCuO86s/FkILbBbnSjxbSkm43RpDGG/xeJr4vSx7hTffB8UAqb ggJYE5BeRX8RDCXLoqhqn4rrRd5Ud/92aOzJ3L9cEPRJHh/l2GmvOVihgOIEJf7wazdq ehM6vGEwmN5TcY9pf55fJIG+QH5pATEae6RgaNrFI2wZR2LV9lhfcZT39qEBdL+6O04I H0lCgXNCU9jBbCviRjAymGELDnEEg1220XgxpylhQPN1i4XMeXSd7gOlqiwluml6OE98 v7Dg== X-Gm-Message-State: AJIora+UDPM3QeW84WTHO8cicind8834NlGL3Q0lFoVGr4xtbA7Z2tmk w/JosYCVvG66+JaLeHu6m/0= X-Google-Smtp-Source: AGRyM1seazjmesyL9M4iNmZaGp7i7fIpXiCBQjdNbxLsOqkRBXmMNAquyaefluz7IpklOU2eeireYw== X-Received: by 2002:a05:622a:1983:b0:31b:f165:8538 with SMTP id u3-20020a05622a198300b0031bf1658538mr33409402qtc.358.1657129388361; Wed, 06 Jul 2022 10:43:08 -0700 (PDT) Received: from localhost (c-69-254-185-160.hsd1.ar.comcast.net. [69.254.185.160]) by smtp.gmail.com with ESMTPSA id v18-20020a05620a441200b006a701d8a43bsm24772765qkp.79.2022.07.06.10.43.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 10:43:08 -0700 (PDT) From: Yury Norov To: linux-kernel@vger.kernel.org, Andrew Morton , Andy Shevchenko , David Howells , Ingo Molnar , Geert Uytterhoeven , Jonathan Corbet , "Kirill A . Shutemov" , Matthew Wilcox , NeilBrown , Rasmus Villemoes , Russell King , Vlastimil Babka , William Kucharski , linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org Cc: Yury Norov Subject: [PATCH 10/10] lib/cpumask: move some one-line wrappers to header file Date: Wed, 6 Jul 2022 10:42:53 -0700 Message-Id: <20220706174253.4175492-11-yury.norov@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706174253.4175492-1-yury.norov@gmail.com> References: <20220706174253.4175492-1-yury.norov@gmail.com> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657129389; a=rsa-sha256; cv=none; b=s+yTEaD/Cusz15JkxVvOPIepx0GVrglo46E/FUDY4dACMnGuxdhcweNJoEoBEE8n+DM8rG H68UsU5GH0t/qlO4YauiH0y9yvkWCFCJLCbXpbqJw1evRcrQ5pZKjJFgrHk5hCgq0Wp/Jf O9tTLA1a1vsewk6Utr2iVh/5e29dv/I= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=k+hw5BFl; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.160.179 as permitted sender) smtp.mailfrom=yury.norov@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657129389; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=yfeDuyRYNoVK5OuNHYtPJI0+qGNG77BF8q+9jUECqCA=; b=FSabr5Vn83J/APM7hWKFRbOoR6eZbUaWFmNCoQXvBeXhn2a/1jb3qBAQuJN2/PGmXgGYdQ dgqjbQgcBtoT3HmYinTX/nVCiJ1ySjP6ow+WxKjBWw6VAGVkwxsvPZawhgbBbpgA29+g8X RoIC9DPZOpOlD90H5MB1KxKbadkoars= X-Stat-Signature: o7x3h5ohcbyme5ji58n1mdh7pa4bhk55 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 2E3F5180030 Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=k+hw5BFl; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.160.179 as permitted sender) smtp.mailfrom=yury.norov@gmail.com X-HE-Tag: 1657129389-777019 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: After moving gfp flags to a separate header, it's possible to move some cpumask allocators into headers, and avoid creating real functions. Signed-off-by: Yury Norov --- include/linux/cpumask.h | 34 +++++++++++++++++++++++++++++++--- lib/cpumask.c | 28 ---------------------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index ea3de2c2c180..80627362c774 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -12,6 +12,8 @@ #include #include #include +#include +#include /* Don't assign or return these: may not be this big! */ typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; @@ -794,9 +796,35 @@ typedef struct cpumask *cpumask_var_t; #define __cpumask_var_read_mostly __read_mostly 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); + +static inline +bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node) +{ + return alloc_cpumask_var_node(mask, flags | __GFP_ZERO, node); +} + +/** + * alloc_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 ). + * + * See alloc_cpumask_var_node. + */ +static inline +bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) +{ + return alloc_cpumask_var_node(mask, flags, NUMA_NO_NODE); +} + +static inline +bool zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) +{ + return alloc_cpumask_var(mask, flags | __GFP_ZERO); +} + void alloc_bootmem_cpumask_var(cpumask_var_t *mask); void free_cpumask_var(cpumask_var_t mask); void free_bootmem_cpumask_var(cpumask_var_t mask); diff --git a/lib/cpumask.c b/lib/cpumask.c index cb7262ff8633..f0ae119be8c4 100644 --- a/lib/cpumask.c +++ b/lib/cpumask.c @@ -70,34 +70,6 @@ bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int 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); -} -EXPORT_SYMBOL(zalloc_cpumask_var_node); - -/** - * alloc_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 ). - * - * 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); -} -EXPORT_SYMBOL(zalloc_cpumask_var); - /** * alloc_bootmem_cpumask_var - allocate a struct cpumask from the bootmem arena. * @mask: pointer to cpumask_var_t where the cpumask is returned