From patchwork Tue Feb 27 19:23:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13574331 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 9F502C54798 for ; Tue, 27 Feb 2024 19:23:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7327A6B00F2; Tue, 27 Feb 2024 14:23:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6BBD76B0103; Tue, 27 Feb 2024 14:23:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4BD1C6B0102; Tue, 27 Feb 2024 14:23:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 1FAC56B00F2 for ; Tue, 27 Feb 2024 14:23:44 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id E5F46A0D72 for ; Tue, 27 Feb 2024 19:23:43 +0000 (UTC) X-FDA: 81838558326.06.C5A7143 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf18.hostedemail.com (Postfix) with ESMTP id 75CD51C0012 for ; Tue, 27 Feb 2024 19:23:42 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=EDVCUV4B; dmarc=none; spf=none (imf18.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709061822; 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=FdLtRLHCzKNRIhr5suA6NuiY6ZuyFfoGulNIYAZdmaE=; b=Up84F0tOpW40a7r93ybjcq5NvfqDIACFRY9fh7KwB64ylhFVwJmq5MqMMIe/NpsEja9yy6 X8bo6Lu0/KSt5rihpK1uFygT29LxcVAYBS3W+wXK3M86MR0wHKE/xb2uMdQNB80GDf6DKZ wOUnwMkWukSYpnC5aGpIhFOwKO+ZxTM= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=EDVCUV4B; dmarc=none; spf=none (imf18.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709061822; a=rsa-sha256; cv=none; b=vQ2OC+Flf0pGn+BMCh+T7YOP2YPVMoDsooWjk8dAm1f2RYVp/dHq51mI30pbUPQET1o6ve ojgxz0oF3cF+NATixu3yUQM2cYy70i2+YHa/yX5f9hRpzWuMZOqZ6Gus0YKakTahJ1e0g/ Gr31vVxxDeXRERU78QGKDDznSgmmnS0= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=FdLtRLHCzKNRIhr5suA6NuiY6ZuyFfoGulNIYAZdmaE=; b=EDVCUV4B0/NpW69zV0/99OuWno C4ASZs5DtQIS4fVuQ+sympDpGsGOMkrhGkxDM0lEldDcNwVY9n9Plhlel3JtW7YFd+w9g/35Xjt8c XSlMR2D11eBGvq6slhrUMVG9/fS+aMCXQ8nUwMJfU924LW5aZujSuOPbU9cuwPzZU4t0JaT3zAryw N7osbBMFtSstZJFAq/nhEJNnLdv6r1MUiSPlyEwHjQlZLZJXKDY7ADRdDBbaZeZUTFIRaWoQwopBd t9sfisspaah79oR0rMPNrtZf6SeNLC+FnmwAKnPv25mnq2nvKqoaEb78KhPmS7nRi0Bf1wd/CeXAG dB8DPsbg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rf33C-00000003B0y-3qdO; Tue, 27 Feb 2024 19:23:38 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 1/8] mm: Separate out FOLIO_FLAGS from PAGEFLAGS Date: Tue, 27 Feb 2024 19:23:28 +0000 Message-ID: <20240227192337.757313-2-willy@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240227192337.757313-1-willy@infradead.org> References: <20240227192337.757313-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 75CD51C0012 X-Stat-Signature: c89zt7icz94q8xonc7araktqox5pjbxw X-Rspam-User: X-HE-Tag: 1709061822-535343 X-HE-Meta: U2FsdGVkX185hu6zRNOdd1E8m1YcVUHADoDmJN7z5Z+gX6ykEQyLpZBKGHP5jpvS5rGExExnaAMC9cn0cQJbM/c8GQyS5IWNLmd9eU1UvrXaho09pmEO32atoJ2sNQAZMmwqZpTUYp2ISEhVCRp6PPYgIFERuv26qSx1a+IgU0LaTRyZ4f8+rElttWJMzpA6+VWcBv99EJlqGylEBQLS0O9Otboz6klv+ZjngxFAH8XyWQzgqIu8uVWg7ug2Cgy3XEwoEshtfzCIVM8fINpINgdnqkw16jg638lpOFFzqmDLDArvsXucH6jNqXch1qo2OnmgO7JdQ2mM73aXBoH19DzW5IUb3g9hUSiJ8KUoi9b130yB8mu9i2ewdkyApQkntSCV9jsjv4VC6R35PBpkmAlWg+NeTKaFiqffxeY9mizB//dZilK9Y9M2XhyT12dkmDS63f6gZLl4+z7LTnNmwoX0bAYN+ncP68E9d9QVBVpSEd6rCtA4XuK6p59gjAPuwZzYQq2AE2UxW34lvu/NYnk7+a88qJfAaPgmNJZqjBjjeuPR8PSJD1boQ2hWKX9CQVaJe/c+lVH4vzcKxMDN1ztg+K6tfhki3dpVZspwysoZJTMBD73+XRMBHRW18mU/PbgW8Txf2DJlDt3CT+/9HF1FJ149CaYF8Dg5pfpN27468GfSVElk2mp0H84eOS9+LeQGaaB+KgHKtVQT2aQIw2rfhAOVTLuwX0RSnmKtu2XB/Mc3ZR4gtrCaTXKcXhS/oyvWpVvlSS4WcVf+XUc6r5GnDmAeKM2XAoMa4G80TZBNdBYgOnsaWld+hiYjcn4j/FpNebaL/axhUV9j7yHXpp03D6/smzrkKzCs7h/G2xfyNIslWUXT4dvzcCkEVsDLasJzLYJyVEU3hMdTcSMq7C2nkqTa9iMub1XxkDoU3P4= 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: List-Subscribe: List-Unsubscribe: We've progressed far enough with the folio transition that some flags are now no longer checked on pages, but only on folios. To prevent new users appearing, prepare to only define the folio versions of the flag test/set/clear. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: David Hildenbrand --- include/linux/page-flags.h | 63 ++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 735cddc13d20..95ab75d0b39c 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -367,54 +367,77 @@ static unsigned long *folio_flags(struct folio *folio, unsigned n) #define FOLIO_PF_NO_COMPOUND 0 #define FOLIO_PF_SECOND 1 +#define FOLIO_HEAD_PAGE 0 +#define FOLIO_SECOND_PAGE 1 + /* * Macros to create function definitions for page flags */ +#define FOLIO_TEST_FLAG(name, page) \ +static __always_inline bool folio_test_##name(struct folio *folio) \ +{ return test_bit(PG_##name, folio_flags(folio, page)); } + +#define FOLIO_SET_FLAG(name, page) \ +static __always_inline void folio_set_##name(struct folio *folio) \ +{ set_bit(PG_##name, folio_flags(folio, page)); } + +#define FOLIO_CLEAR_FLAG(name, page) \ +static __always_inline void folio_clear_##name(struct folio *folio) \ +{ clear_bit(PG_##name, folio_flags(folio, page)); } + +#define __FOLIO_SET_FLAG(name, page) \ +static __always_inline void __folio_set_##name(struct folio *folio) \ +{ __set_bit(PG_##name, folio_flags(folio, page)); } + +#define __FOLIO_CLEAR_FLAG(name, page) \ +static __always_inline void __folio_clear_##name(struct folio *folio) \ +{ __clear_bit(PG_##name, folio_flags(folio, page)); } + +#define FOLIO_TEST_SET_FLAG(name, page) \ +static __always_inline bool folio_test_set_##name(struct folio *folio) \ +{ return test_and_set_bit(PG_##name, folio_flags(folio, page)); } + +#define FOLIO_TEST_CLEAR_FLAG(name, page) \ +static __always_inline bool folio_test_clear_##name(struct folio *folio) \ +{ return test_and_clear_bit(PG_##name, folio_flags(folio, page)); } + +#define FOLIO_FLAG(name, page) \ +FOLIO_TEST_FLAG(name, page) \ +FOLIO_SET_FLAG(name, page) \ +FOLIO_CLEAR_FLAG(name, page) + #define TESTPAGEFLAG(uname, lname, policy) \ -static __always_inline bool folio_test_##lname(struct folio *folio) \ -{ return test_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); } \ +FOLIO_TEST_FLAG(lname, FOLIO_##policy) \ static __always_inline int Page##uname(struct page *page) \ { return test_bit(PG_##lname, &policy(page, 0)->flags); } #define SETPAGEFLAG(uname, lname, policy) \ -static __always_inline \ -void folio_set_##lname(struct folio *folio) \ -{ set_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); } \ +FOLIO_SET_FLAG(lname, FOLIO_##policy) \ static __always_inline void SetPage##uname(struct page *page) \ { set_bit(PG_##lname, &policy(page, 1)->flags); } #define CLEARPAGEFLAG(uname, lname, policy) \ -static __always_inline \ -void folio_clear_##lname(struct folio *folio) \ -{ clear_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); } \ +FOLIO_CLEAR_FLAG(lname, FOLIO_##policy) \ static __always_inline void ClearPage##uname(struct page *page) \ { clear_bit(PG_##lname, &policy(page, 1)->flags); } #define __SETPAGEFLAG(uname, lname, policy) \ -static __always_inline \ -void __folio_set_##lname(struct folio *folio) \ -{ __set_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); } \ +__FOLIO_SET_FLAG(lname, FOLIO_##policy) \ static __always_inline void __SetPage##uname(struct page *page) \ { __set_bit(PG_##lname, &policy(page, 1)->flags); } #define __CLEARPAGEFLAG(uname, lname, policy) \ -static __always_inline \ -void __folio_clear_##lname(struct folio *folio) \ -{ __clear_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); } \ +__FOLIO_CLEAR_FLAG(lname, FOLIO_##policy) \ static __always_inline void __ClearPage##uname(struct page *page) \ { __clear_bit(PG_##lname, &policy(page, 1)->flags); } #define TESTSETFLAG(uname, lname, policy) \ -static __always_inline \ -bool folio_test_set_##lname(struct folio *folio) \ -{ return test_and_set_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); } \ +FOLIO_TEST_SET_FLAG(lname, FOLIO_##policy) \ static __always_inline int TestSetPage##uname(struct page *page) \ { return test_and_set_bit(PG_##lname, &policy(page, 1)->flags); } #define TESTCLEARFLAG(uname, lname, policy) \ -static __always_inline \ -bool folio_test_clear_##lname(struct folio *folio) \ -{ return test_and_clear_bit(PG_##lname, folio_flags(folio, FOLIO_##policy)); } \ +FOLIO_TEST_CLEAR_FLAG(lname, FOLIO_##policy) \ static __always_inline int TestClearPage##uname(struct page *page) \ { return test_and_clear_bit(PG_##lname, &policy(page, 1)->flags); }