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: 12908449 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D3347C43334 for ; Wed, 6 Jul 2022 18:00:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IgninNJnRkuPqaWJku4Ag8KmFZXSsN8tFFxDe2ZhbmE=; b=AquXC7UY2npupn dEa+DcFu1ux29Pd6IT71CdgD2xgY3JBTQSxl7VR8yi/vuL4Ft6eqszFDCJE2l3Agy5+Ldku8voZue d12CQXqzPTOn+VQb6GnXLpgSHtbJw+ZqPGCyAVT3U7clVYVON9kv8EF0I2infIZKODANcODvfHlxp DHsp0sFAkvfBBevNlYsa9NqVtt4Y1/Urpyt8XW4Hc74721g/TKRSUHZrmtjG6W8OSds9BWFceHmSc yasAVp3w64i5fv/Nelx7/fabDkIlixFucwzPyFhKnep8XxWxBWZ2VQHSurp+fK3/etRqCNkC72FSO q6XsAj9XZTs0fjmQ+MvQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o99JT-00BsVw-83; Wed, 06 Jul 2022 17:59:47 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o99JL-00BsQD-D7 for linux-arm-kernel@bombadil.infradead.org; Wed, 06 Jul 2022 17:59:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=yfeDuyRYNoVK5OuNHYtPJI0+qGNG77BF8q+9jUECqCA=; b=G6bLR0M5l6Q5WraogSxELwnKrt bAHRa8xfjQJdUmJIeniIkd8bqVNjn2PVZJVJUz2PjIALVJXGlCMLs2Y1CciWTlTUi+h+7yBdcsDmM ODPSPmActpzC+BIHGCr4zOr1Yj/nr0aEN1vTv+qlW96gRXyWA52oynyEuJjCVJedzQKWcTnK99hzo FqvOuSr9pu2OTaN49zJQMFhAFe9Fr9Qo3BZJV1/vpC4WgsF6NVJTHB3cf87CEmT0a8jI+iZwsOgVj 5/q6bWGRksRTfhxknQzMIAIe7iN9HYGd5ioocvZN/oKb+N3xwnL1iFuVGIMn8QA5JMq7UrNMRC+Ts lzYj6YCg==; Received: from mail-qt1-x82f.google.com ([2607:f8b0:4864:20::82f]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o993V-000u9U-KQ for linux-arm-kernel@lists.infradead.org; Wed, 06 Jul 2022 17:43:22 +0000 Received: by mail-qt1-x82f.google.com with SMTP id c13so19253169qtq.10 for ; Wed, 06 Jul 2022 10:43:09 -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=fkrr6NSpygUFzAPiD3CREIVSbC3nEKNaSfzjY3mCozoPRTUFs31dMrFa2HmuX+OxhH wWxYT0f3rSpSFnXWWbmYOIpm3sJhLxwZUgLkuea/NJuiEsDfnBNNFLXNX39ltOGzUFre gwbwoBcmsUqgS+EKjTn8G3rFTAHZj0CmzxQQ8u6UCIUD/GYJQEhvcKAfkJcRdBsn3L5Y CSza2A9wwCkYY8syVRXyEPxkQf1mhsgkp3oAznIgSiqaXksrpppsNyHHTsRBYKjafRvA 6C7k9fuSd5Lz7nrcZTUMBhxb8qXFM6EYopiHItGbMNVZYHcCUqtA2XNumOr/8x4AdhIQ y5JA== X-Gm-Message-State: AJIora+A7VmBOXRG443dc9dd4hp4WMEfbAYB5TW7tNX/yB709ZWPVMRl WFQ/I0ip/zmlGxwZjzHRZVU= 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220706_184321_215247_BC793404 X-CRM114-Status: GOOD ( 14.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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