From patchwork Fri Jul 1 12:54:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 12903270 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 E6213C43334 for ; Fri, 1 Jul 2022 12:58:03 +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=5CjTDf+NpIrmxiGqpvFy/0/SyZfIfUyXSDttKsNFC0A=; b=l7QSHCNwyekfgC yLWGRibhWEoAz2Gyh3Q0KwwhjC2kK5Y6fRG+7B2YH8SGxtk5SFcz79+iZx+VTt4YQcXiFNR/MZtuO KyytHnJp71mglkciSq2EtlSmKrBNam3hyfOuw6lfwfJMKfYM4biuYsii5Y+N8goe5btfYG4jya5aB apSdlnU+uAe24OGSSWyD/4ZP1njPoTLwTACh/4GU05CSOx3+/vQLMddsf7xi0nFxI4KNy22tnfLbH KVLzWRt6EPzzYIthPPJKew5Vjw6tmEMWd4iD4DMI5rejj/IjrcMwJZ15t+xX/hDCY42EwQ9/xbi8u PQ58CIs/U3bd5LAGEc/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o7GCb-004scE-3d; Fri, 01 Jul 2022 12:56:53 +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 1o7GB7-004ruH-P1 for linux-arm-kernel@bombadil.infradead.org; Fri, 01 Jul 2022 12:55:21 +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=1Gf0HCV+B4rZrfJAP5Zzmb/SkEYLt2rvf4yUabNLaBM=; b=f4w4lUzUcyfe+efVQmdguf0htQ yGU1z8EO+ATTfoimzWXzCct7dax/94CcrsDZVM/PF9bWuelbKx6rzX8KI9N6lYV/gYkhhjoHEW5rv RIIV3BUZQ7WhKODT+vIfNGJV87tKn3GkwaLfxpLkmLVSrckCYgLDkpM3dqcw59fwXslZZdBWwNP6Z hhpNW9fmfVCQGAes1bq8VRMNW05oJ3p0NAEPctKMe+s8QBcFcW18DNhVArH3i870/1jMMtSXkdhWz iqh0DCs84BKkDAwSpbH80qP72KSmxy4Mv8/6x9DForIxKvD0+tM1TevZPWVCODJ81HxkfhUjl6Eh9 LSDgiiWA==; Received: from mail-qv1-xf2f.google.com ([2607:f8b0:4864:20::f2f]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o7GAl-00Figj-NB for linux-arm-kernel@lists.infradead.org; Fri, 01 Jul 2022 12:55:12 +0000 Received: by mail-qv1-xf2f.google.com with SMTP id u14so4041761qvv.2 for ; Fri, 01 Jul 2022 05:54:44 -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=1Gf0HCV+B4rZrfJAP5Zzmb/SkEYLt2rvf4yUabNLaBM=; b=m3gzMyaX9F96et1o8wS9j16V2SjRTjHJI5dhb2wg/ahdsdNWOvWCjNETS07Atq8YSZ NCEMufsi5CUvVxRdlOBBHoBsJ+AclOhKsErjlEIbR0thodZH+OTFFxsLate0HeHdmUy9 OXvJjC27aukUSgFVM4vv/MwcxF3jVfgbHAAgEOq9hjI+XeygOokAGfg4pSoA+lHmzVSm noCvYgAWh2RfNQxyTN049m7pZE5GQGDVmU+0vL0yVl3lETfS8kJbvSsMVsXd5j9dWUJ1 Sxnake72rCg2Icjcrtq4sdayDe9wTuDv6bTLViCCmwLNo7VQiPeo7yeryEV6tTk+WRP8 6Vmw== 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=1Gf0HCV+B4rZrfJAP5Zzmb/SkEYLt2rvf4yUabNLaBM=; b=t97zMpk9EvENb1TmEWxEDSjgNQduHlVxLchtPjaEInpq1C7sM1K1zUXfFQ7rDqWlEx +WFK7F9xNcxWJRMKyCGOO3JbC/ROEyHQPKoAQ85WY9N+HY/OIiX4aiGHnXD/4pnY+gc4 rl4OQ/xR/NGiXVTQJ9JSxdki/EdmRl5HakVvZA0IPVEc99IeB82O0dF76Gn1whVegIac 80HRjQelD6g0x8ccLbstK0YRGFDSuowrBjMlo3RoAXtmkasd+nnvuEsusBp8TZiVC33A aptbstCzg1HTpywTjeOrXDJelFN3Fjr3moRuaFtWjYdrjk8BuNCW7JeGyTteQlJQxXlt kwBg== X-Gm-Message-State: AJIora+0f+uGERM2jyAEC8VvxjHlFReJOw1rA16ssL9VIMA03xXCgeNp 3Z6/1FYuNsON/4/NXpW9hBw= X-Google-Smtp-Source: AGRyM1ssrxAWIQQigtyIX+ADjOkwuYwaxPAK62qYcGGaz4u/H2t0ROYqO9PWoZpEzilBKv8ddLPPIg== X-Received: by 2002:a0c:c68a:0:b0:46b:8e6b:306 with SMTP id d10-20020a0cc68a000000b0046b8e6b0306mr17084010qvj.7.1656680082228; Fri, 01 Jul 2022 05:54:42 -0700 (PDT) Received: from localhost ([2601:4c1:c100:1230:f902:9816:653f:2f66]) by smtp.gmail.com with ESMTPSA id t18-20020ac86a12000000b00304bbcc1b8asm14228141qtr.28.2022.07.01.05.54.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 05:54:41 -0700 (PDT) From: Yury Norov To: linux-kernel@vger.kernel.org, Andrew Morton , Andy Shevchenko , David Howells , 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 8/8] lib/cpumask: move some one-line wrappers to header file Date: Fri, 1 Jul 2022 05:54:30 -0700 Message-Id: <20220701125430.2907638-9-yury.norov@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220701125430.2907638-1-yury.norov@gmail.com> References: <20220701125430.2907638-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-20220701_135501_296126_557F4CF8 X-CRM114-Status: GOOD ( 14.55 ) 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 --- After this patch, only alloc/free functions are still in c-file, because moving them causes multiple circular dependencies between mm and cpumask. I'll get back later to it. 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..0738a6c9be40 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