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); } From patchwork Tue Feb 27 19:23:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13574334 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 7F718C5478C for ; Tue, 27 Feb 2024 19:24:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 18AD96B0117; Tue, 27 Feb 2024 14:23:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 112AA6B0118; Tue, 27 Feb 2024 14:23:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA8676B0119; Tue, 27 Feb 2024 14:23:47 -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 D59376B0117 for ; Tue, 27 Feb 2024 14:23:47 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id B370B1A0B78 for ; Tue, 27 Feb 2024 19:23:47 +0000 (UTC) X-FDA: 81838558494.06.B219BB9 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf07.hostedemail.com (Postfix) with ESMTP id 4FB4540003 for ; Tue, 27 Feb 2024 19:23:45 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=b0CUiTiA; dmarc=none; spf=none (imf07.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=1709061826; 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=uXWWIyp7K/HgoFyXnX0l2Co46veb5iiLEnhEjPfsu+o=; b=UjSZFBaC0/fRt+WzsxHJuwDtejto9U8AuSVpIMJKOJveptRTfiQbldxZVi04DRWjy9Wvo2 Il+NsC0jC4ckUMB0njpTiu+EXkSHmyG2g2B9SsbDaR86OYc+wzaCqf0tP7TJPcqg9PXJUe uwACwbrYfHP4TzStEF45/vZbi/otANM= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=b0CUiTiA; dmarc=none; spf=none (imf07.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=1709061826; a=rsa-sha256; cv=none; b=ujkVnwv0vdy+JPVaoG03UMfIpW44ekwBt9pMnkkrI4dOT4LW2/w4nG1/5KdbSCcLbb4UrW IHfZQNOVHRm4VO9xnomabAxDJr/b1rBNEx/CFCK5CSMCdL14rMc8JDOtN+DckMA0LSHDex QUymKxYs7Wj1UjV6UWgJuibffuQSOD4= 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=uXWWIyp7K/HgoFyXnX0l2Co46veb5iiLEnhEjPfsu+o=; b=b0CUiTiAxshFgblwyb3Ah2Pjs0 8ACCeYk+/UrVFv/tUzjZ+S9cCboTkVdFScb3bJ89YwLfFcmGXXy0DRgF2K6e8RDnsTZCv857ye1qc pL+sJ9Y0DdzUktHDUkl8rXTbraNBlvRplt+FrRK18KYd4+2mFKCPEHYcNJ/jFVBA8bVkZwuycja73 cFDTvkUROfD9/TS34KhwC3ez/+3GTnBIxjSkRX4Xpp72F2Nf9vIrsm3jlJX8b7b5Q9wxRTNzoiAPK yk0l4HCPgr4Jdq0+rcLiOEVJW/KZ8Kqen+h/gk3boR7f5Tca3fj02h/WXz641FXhZ52l8Z9p+L2XO 8GIPjHQg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rf33D-00000003B10-03tQ; Tue, 27 Feb 2024 19:23:39 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 2/8] mm: Remove PageWaiters, PageSetWaiters and PageClearWaiters Date: Tue, 27 Feb 2024 19:23:29 +0000 Message-ID: <20240227192337.757313-3-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-Queue-Id: 4FB4540003 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: a7tcss4qw5wkfh5jh8euu6fm5o5gphwg X-HE-Tag: 1709061825-164548 X-HE-Meta: U2FsdGVkX19Yg1X34tvd4ia5c95Sw4L31V57CS0zSQCK9SJ/1lNQfw4ZTXT2q64Yx/uuuKEsuuTL2SkgfULpUO+cDv+SpeLzg53y12bI2/nnGn8CJGOMYIJVklzOVqdqEYi69PRJR6CxXV+U8br6fOBrMmZWM88UHc58iQG8tAQNgLsy7MKjoZ47FjHHXult3g39dBX6iP1hjtzGB8XxLfYHVMHep8UujAygLew6CjHn+w3zKoI0Sw8GTocvhXxNnJg5d2LFjstwlrbrLvmiVEStvQITTy1UA5FiV2Y7XBGsnH3HRXGjbpVfdpakDkd9ndjTydIaCGfUA9z6hYz2kB3N4NUi7O1pSAg25Kyauno7h49oiSSCnGolSdiqDjIMMcdhkjxfyhF/n95oGjhDI9ADdPKxkx91XwJGiHo3TVqALRywKo5oJ8ON8SqutTbZSau+y48Uf1hBfodixKswzhDdigSlQ68S82F8t7Nxp3oW6RiTGfV3XB0hWoqaI6xmWP2YJXwAc0aFyHW2KTk4Jervk9eg/IMNiWbd5ANfe8fbkaoJSY0t/Af+MlvPQFH0ADmI3yMfWk6mknTuZg9n6guAVqfJi0T9zryWHXPW/Y34GAX3QzTAgctvJCqiRbiOvTBwZwqDknSD2GxBR6kya0PfJ0qz68kb4BoTMDqKx0h5BGNFgay+uryJXROROVZCMvIuhBJ9auOzwpM4Ltnp54YDReote6ZI13QT7miysqKJryySJBrhAmxGaWh2NpCumM5fyrbud8b8ObiaPKoPcf1auq2dEWXn7jpWAzFubteLE7UPb5QuNOEm0Ib+gYpqpsOq+vxgy5QrG4yrZAMAk6PMyut7dgOLirvVL8fMmgk0WEeu5taexQ== 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: All callers have been converted to use folios. This was the only user of PF_ONLY_HEAD, so remove that too. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: David Hildenbrand --- include/linux/page-flags.h | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 95ab75d0b39c..d8f5127ae72e 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -328,9 +328,6 @@ static unsigned long *folio_flags(struct folio *folio, unsigned n) * for compound page all operations related to the page flag applied to * head page. * - * PF_ONLY_HEAD: - * for compound page, callers only ever operate on the head page. - * * PF_NO_TAIL: * modifications of the page flag must be done on small or head pages, * checks can be done on tail pages too. @@ -346,9 +343,6 @@ static unsigned long *folio_flags(struct folio *folio, unsigned n) page; }) #define PF_ANY(page, enforce) PF_POISONED_CHECK(page) #define PF_HEAD(page, enforce) PF_POISONED_CHECK(compound_head(page)) -#define PF_ONLY_HEAD(page, enforce) ({ \ - VM_BUG_ON_PGFLAGS(PageTail(page), page); \ - PF_POISONED_CHECK(page); }) #define PF_NO_TAIL(page, enforce) ({ \ VM_BUG_ON_PGFLAGS(enforce && PageTail(page), page); \ PF_POISONED_CHECK(compound_head(page)); }) @@ -362,7 +356,6 @@ static unsigned long *folio_flags(struct folio *folio, unsigned n) /* Which page is the flag stored in */ #define FOLIO_PF_ANY 0 #define FOLIO_PF_HEAD 0 -#define FOLIO_PF_ONLY_HEAD 0 #define FOLIO_PF_NO_TAIL 0 #define FOLIO_PF_NO_COMPOUND 0 #define FOLIO_PF_SECOND 1 @@ -488,7 +481,7 @@ static inline int TestClearPage##uname(struct page *page) { return 0; } TESTSETFLAG_FALSE(uname, lname) TESTCLEARFLAG_FALSE(uname, lname) __PAGEFLAG(Locked, locked, PF_NO_TAIL) -PAGEFLAG(Waiters, waiters, PF_ONLY_HEAD) +FOLIO_FLAG(waiters, FOLIO_HEAD_PAGE) PAGEFLAG(Error, error, PF_NO_TAIL) TESTCLEARFLAG(Error, error, PF_NO_TAIL) PAGEFLAG(Referenced, referenced, PF_HEAD) TESTCLEARFLAG(Referenced, referenced, PF_HEAD) @@ -1138,7 +1131,6 @@ static inline bool folio_has_private(struct folio *folio) #undef PF_ANY #undef PF_HEAD -#undef PF_ONLY_HEAD #undef PF_NO_TAIL #undef PF_NO_COMPOUND #undef PF_SECOND From patchwork Tue Feb 27 19:23:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13574329 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 8F882C54E41 for ; Tue, 27 Feb 2024 19:23:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B481A6B00E6; Tue, 27 Feb 2024 14:23:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6915B6B00E3; Tue, 27 Feb 2024 14:23:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 446D36B00E2; Tue, 27 Feb 2024 14:23:43 -0500 (EST) 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 04ADC6B00E6 for ; Tue, 27 Feb 2024 14:23:43 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D2310140D9F for ; Tue, 27 Feb 2024 19:23:42 +0000 (UTC) X-FDA: 81838558284.16.0D5B7B5 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf16.hostedemail.com (Postfix) with ESMTP id 5C367180009 for ; Tue, 27 Feb 2024 19:23:40 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=DZr0oifW; dmarc=none; spf=none (imf16.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=1709061821; a=rsa-sha256; cv=none; b=QeUR10qB5UVEUFdUJYmzjZwkxnhksx+Vk+QINEYUMmD3h6bCnsa46WNNP5JRN7M9OLYeFW 8gtGEb7FtMSUrYwEE8mDMPnXMDFG5KDkQ5vhag/K4N4tgy5EY3H7fa0FTsOB5vblMFD8rW kAzQOtkGhAHoLj/MdXypFCzLp1hY+FQ= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=DZr0oifW; dmarc=none; spf=none (imf16.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=1709061821; 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=KlfwxT5aWjqFNbR42eGyPERHWLte+mw2TQprAPR5h+0=; b=j+tWpUPEdQcR39zo5nuf5gTh8VpB3y0USG3ArTt6HZJecf4r2BhsrVDi1I5pQpnpv3HsfD XWKmqhd+36hqqSBHDCpVKIXPYDTICOg5tPHN4GsHhOxp+LwGaOOmKl/OADYCbSaTDnc/mb JOIPY2gYHAfBcyaVQGxvxOmYjKT5KQk= 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=KlfwxT5aWjqFNbR42eGyPERHWLte+mw2TQprAPR5h+0=; b=DZr0oifW0vDNpDIVtGzz7ZgC5U YrAGlSFoMg7NNzgpzr/gIS7Iq8KIgiloTfxxmrPYoOvgpLbPymDAh+2U0bbgqjIE4gbrIDKaHIDNl 1jkO5KCo47gt2EuQcttD9ZIEWMQOdISuviTX9rW8IXOXSF68FSWK3IkirEhIsZlPPAIdnAjg9tkwZ cIRaVGY/IUTKtejbmIUwBB9NnurP4AJ+9jzBvc9DriF6FWkFj0fZR+3zr/BbYOdnnqUN1P+CXSd7f ZlXCzGMNgeT3SSv0s5sGNVQtVx0C+qsVgTgE5wTDoi8SB2tD7GXhdTseeMv0D7/ZDvHpPvp6AzsJC uvxafLHA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rf33D-00000003B14-0SCM; Tue, 27 Feb 2024 19:23:39 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 3/8] mm: Remove PageYoung and PageIdle definitions Date: Tue, 27 Feb 2024 19:23:30 +0000 Message-ID: <20240227192337.757313-4-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-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 5C367180009 X-Stat-Signature: gnu9a5q1uqon71y17skpyxkfrkoq1pdr X-HE-Tag: 1709061820-923052 X-HE-Meta: U2FsdGVkX1/jMzmOVymA9ZylEDQmZZb6uj72ebaPMmqIXFcEL2ypSn+wRKM1zXSiTLz/vxiR9BbenPkD4GMHz7MD74hRqwb5ApXF9AeMAC4aMsj/dgyNpvfnedhXmuNr7RryuhfuA9YXMjyF/5QKrL2XAYVI3tSj7dgQgPPok86PjLFGm4QxSR6cl6sq6XcoNAF0eXORHqZ73o1eco16X4Diu8VVh6FOpSbgmb6zOEjfbzCG/59n6x4O6B2thXc6xEPWD+n3GZjzaS2YFF+FAq8TVTZUczJqxvA9TLmB/HXx2W7DZEYKaq4ay7AEw3k//x8ylCq9Hx6YowdD7hZoitGnkgeAl6cwxFq9VVhZA/4Cl5rwlhPzu8jRJl369nfQ7KlytGgYdE3cSJ+GwtjYwBsZASPp1eV8gdj7MUxtsTz2KJCEkA+d4jt1/3CSifLwjnnuqE79F8018NirPz/ZK3uA2fin95Xt3CmAkVBkZ5Orgl93y/zZcAAn0LlH+qDRbbP6Z1oVDkNaMwaPWZ/rJ4MHI/wFNPDN73fHnC/A6GX8ItPENVA5czG/cCL24lY4CqfiH7urF3eBgIE4ihQgwmQcdf1WO8RhF4wOtRavY8qNorxAa83f4Ea9RREM76RiNQPS11KcYb4EXS+qyZ5J63fI0Ok9OsvZp6DTyWgDWzO8u04aDEc36/bCn2k0nelvR/BDx1C74j0VTzZJLyEUwKQe3epxTsLsdA4SNxs0pErsDjl5WmssY1etfuGAnZ0tTCUcgL6uaRquB7KcHAfiVs0bRTdKxEM1Bvoi5TSMNXtEZOvHt9sN7lFcIxQJQctnEkabjzvUqQ+GfxhV3n2BiIgrmqufZ3wtodLZcmLh0fjc0Uadmywbbw== 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: All callers have been converted to use folios, so remove the various set/clear/test functions defined on pages. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: David Hildenbrand --- include/linux/page-flags.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index d8f5127ae72e..582ca7400eca 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -599,10 +599,10 @@ PAGEFLAG_FALSE(HWPoison, hwpoison) #endif #if defined(CONFIG_PAGE_IDLE_FLAG) && defined(CONFIG_64BIT) -TESTPAGEFLAG(Young, young, PF_ANY) -SETPAGEFLAG(Young, young, PF_ANY) -TESTCLEARFLAG(Young, young, PF_ANY) -PAGEFLAG(Idle, idle, PF_ANY) +FOLIO_TEST_FLAG(young, FOLIO_HEAD_PAGE) +FOLIO_SET_FLAG(young, FOLIO_HEAD_PAGE) +FOLIO_TEST_CLEAR_FLAG(young, FOLIO_HEAD_PAGE) +FOLIO_FLAG(idle, FOLIO_HEAD_PAGE) #endif /* From patchwork Tue Feb 27 19:23:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13574330 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 D2238C54798 for ; Tue, 27 Feb 2024 19:23:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 13F166B00E3; Tue, 27 Feb 2024 14:23:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0D1C16B00ED; 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 DA0816B00F6; Tue, 27 Feb 2024 14:23:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id A5C9C6B00ED for ; Tue, 27 Feb 2024 14:23:43 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 6F828A0D72 for ; Tue, 27 Feb 2024 19:23:43 +0000 (UTC) X-FDA: 81838558326.12.6F8B574 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf27.hostedemail.com (Postfix) with ESMTP id C1DF94001D for ; Tue, 27 Feb 2024 19:23:40 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=T2kf4OuE; dmarc=none; spf=none (imf27.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=1709061821; 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=JAWJd0ynHxn8bDec82aB+5H7xTi2L5NLwYca1kGHHD0=; b=DpPyQXbEpxEj4xfpBEQIPIIasFEP8l+kKKWt8oTAWnvNdDzddk4jSVadpSb2dEKKV0TPpc D9sLgrwEWg4vOWzjy8xCom/Jotv369+D/q46kg+x5KE9kTv3Yzv8NnvREQbmNYDPtwNnN4 Vh1cOG2fj45Ll2dMGkK6sb+Oy/g8gv0= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=T2kf4OuE; dmarc=none; spf=none (imf27.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=1709061821; a=rsa-sha256; cv=none; b=Mg0E9m3QUE9FFP6y1LvMducmKfJIHo4GHVHyw/hmAt4PCmpPEpDe2TKnquOfpzbKl5dnuZ qrxBKe1/ycmpSPvcL7umoRYpRZP3MkR5KF00eF1gUOwwFNaW8R+3qYsoDH/vRK9/STMVkQ Xpq1gADNowV14b5IEJgfVFs25wte9bc= 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=JAWJd0ynHxn8bDec82aB+5H7xTi2L5NLwYca1kGHHD0=; b=T2kf4OuEvoY38GYQlK2jwGeYoW /oB+aFiAKE8Eu11akOA0rZxNRgk4u+fiBjnopDgJTf3fSyyXrdgXLpcWpwkJYhCVNXs33DccRSJPU FEJOsCm3QN+jpmc6OZCGt9ADqi0GS+S839u0wpAH7EtOlr1R7xVhgt7rQup8noj8GvmUJBGvz1LyC zJCWcYHxzDLLZo+wmuJ8TNQRywXUQpwdAfQXKG9yG5bifQ+e3zbiiy0bwc01QWOGCPRVXZ+9ooWSn 2O0QIWHT3V9RUhTAEV5UaunyuxtaTLj/FxKgEk3L59CEqVrOLx4tPCUw6lDCDHO8+OPzQoeihRc31 0HvkeMIA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rf33D-00000003B1B-0sPO; Tue, 27 Feb 2024 19:23:39 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 4/8] mm: Add __dump_folio() Date: Tue, 27 Feb 2024 19:23:31 +0000 Message-ID: <20240227192337.757313-5-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-Queue-Id: C1DF94001D X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: by6uhsafe7ju7nm3scqxc5x7zfreyece X-HE-Tag: 1709061820-389813 X-HE-Meta: U2FsdGVkX19RwjBTLX+WPtS6xtsHQblbZXVPI0nH7jJHpUWZ6i1sRsn7TMLbkhhbomcsvHkNBYoGF3ALN37wJ/yeq+8bJU2o7yYu6VaHoaH33MkrpHaPOiecy0y4KzA8wYawgxGNvwhavt5DJMFvlyNvV2nUQmeYHgx0Rk1loS7+u8RoIUMF28e6SJUOJJac0odxjl81WyykpQuG4ip/5txdJOPnTM0OOfQiwsDbCuGZUOG2VI9w1nFfVshLe//8Dvi/27RyqSer+jIGZz5lekhASOnd4S7KwkBjnonIj9tCeXpPOC2jx5jXopZ8J/nW9sLZw/PHko8Xchee0oi4BgYzxjfV78h61mJf1FK1ScvEfmQDSkv2F78IPYPh5PNPJz5AnW9SDW1LtA1K71Vb/giUlknPMlxmTG+0Y6egtdz/wkuApBTYJhn2DoNokaaXws4vg9djVINtnQvwIammyYoHAKy0W3yVpn/vvxQIslLbXWtFrCMTnVA/Daa9gMJTnY2TklqI+NGGjUTU4LDCtZ72eRqhFb+fGeBoMRkaBx6MrvWAi7AZE+Qn00/Mg6PDc9YK20TwWcS3Gg9KPQMVbZP8Ek5PrE6U8yH0ZbhIlvzOC53ClyWKrxIWP2YYqIs8CCkM9UzqwzhNzzRqjXbI77a6IW60ymEW1uQ9m6/4GcIhP+nM5gvUwgAkZMwcFK7eCxzQ5aikOIIriSozWdSqtFZ6vfTuMJ/K0MRO67Cek7vdlf3+R2d/mqqdZTW2buMbjus9RQFY0pVbqxkY0rfQALyaVWbGeHwEKkamLCbvv1qq94ovOdf1n1OGff4fzCTxxEYHnZb0ytuV5KkjUkosXGFZkH2SzOBN+mcBsmoM4upynu4CIXnJzyrGUh6nP6QCck+5d/fgwM1E6ds9HFDJi0Wqh9jeEGAt2kLCbX8OACGy8FXukHvsq4t7Ap/UHpLf++QikSmKNei5h8XbwZz WxFmHA5W AjUM4nTRYv0vtQRbGc+j87TmUm1lddQQAu/RRnjFqh/C3wtTxNQPQQPp3dXLlpdEOzX0Rgjvv1HwrdMN2ISyY5DO6K/yHFxVwosjQa0oOzbnnm1iKIf7fHtzeAQuc+Bd5dLRnY7TnL/wvSAruIc3hmiEZDS58hu5VBf9ZndAx9ohiXFTjDWOmzUKdqnZj1oqZkBszcnmczG1WsR5wN2gnd1P+1M6H+N0CbqVG 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: Turn __dump_page() into a wrapper around __dump_folio(). Snapshot the page & folio into a stack variable so we don't hit BUG_ON() if an allocation is freed under us and what was a folio pointer becomes a pointer to a tail page. Signed-off-by: Matthew Wilcox (Oracle) Tested-by: SeongJae Park Signed-off-by: Matthew Wilcox (Oracle) --- mm/debug.c | 120 +++++++++++++++++++++++++++++------------------------ 1 file changed, 66 insertions(+), 54 deletions(-) diff --git a/mm/debug.c b/mm/debug.c index ee533a5ceb79..96555fc78f1a 100644 --- a/mm/debug.c +++ b/mm/debug.c @@ -51,84 +51,96 @@ const struct trace_print_flags vmaflag_names[] = { {0, NULL} }; -static void __dump_page(struct page *page) +static void __dump_folio(struct folio *folio, struct page *page, + unsigned long pfn, unsigned long idx) { - struct folio *folio = page_folio(page); - struct page *head = &folio->page; - struct address_space *mapping; - bool compound = PageCompound(page); - /* - * Accessing the pageblock without the zone lock. It could change to - * "isolate" again in the meantime, but since we are just dumping the - * state for debugging, it should be fine to accept a bit of - * inaccuracy here due to racing. - */ - bool page_cma = is_migrate_cma_page(page); - int mapcount; + struct address_space *mapping = folio_mapping(folio); + bool page_cma; + int mapcount = 0; char *type = ""; - if (page < head || (page >= head + MAX_ORDER_NR_PAGES)) { - /* - * Corrupt page, so we cannot call page_mapping. Instead, do a - * safe subset of the steps that page_mapping() does. Caution: - * this will be misleading for tail pages, PageSwapCache pages, - * and potentially other situations. (See the page_mapping() - * implementation for what's missing here.) - */ - unsigned long tmp = (unsigned long)page->mapping; - - if (tmp & PAGE_MAPPING_ANON) - mapping = NULL; - else - mapping = (void *)(tmp & ~PAGE_MAPPING_FLAGS); - head = page; - folio = (struct folio *)page; - compound = false; - } else { - mapping = page_mapping(page); - } - /* - * Avoid VM_BUG_ON() in page_mapcount(). - * page->_mapcount space in struct page is used by sl[aou]b pages to - * encode own info. + * page->_mapcount space in struct page is used by slab pages to + * encode own info, and we must avoid calling page_folio() again. */ - mapcount = PageSlab(head) ? 0 : page_mapcount(page); - - pr_warn("page:%p refcount:%d mapcount:%d mapping:%p index:%#lx pfn:%#lx\n", - page, page_ref_count(head), mapcount, mapping, - page_to_pgoff(page), page_to_pfn(page)); - if (compound) { - pr_warn("head:%p order:%u entire_mapcount:%d nr_pages_mapped:%d pincount:%d\n", - head, compound_order(head), + if (!folio_test_slab(folio)) { + mapcount = atomic_read(&page->_mapcount) + 1; + if (folio_test_large(folio)) + mapcount += folio_entire_mapcount(folio); + } + + pr_warn("page: refcount:%d mapcount:%d mapping:%p index:%#lx pfn:%#lx\n", + folio_ref_count(folio), mapcount, mapping, + folio->index + idx, pfn); + if (folio_test_large(folio)) { + pr_warn("head: order:%u entire_mapcount:%d nr_pages_mapped:%d pincount:%d\n", + folio_order(folio), folio_entire_mapcount(folio), folio_nr_pages_mapped(folio), atomic_read(&folio->_pincount)); } #ifdef CONFIG_MEMCG - if (head->memcg_data) - pr_warn("memcg:%lx\n", head->memcg_data); + if (folio->memcg_data) + pr_warn("memcg:%lx\n", folio->memcg_data); #endif - if (PageKsm(page)) + if (folio_test_ksm(folio)) type = "ksm "; - else if (PageAnon(page)) + else if (folio_test_anon(folio)) type = "anon "; else if (mapping) dump_mapping(mapping); BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS + 1); - pr_warn("%sflags: %pGp%s\n", type, &head->flags, + /* + * Accessing the pageblock without the zone lock. It could change to + * "isolate" again in the meantime, but since we are just dumping the + * state for debugging, it should be fine to accept a bit of + * inaccuracy here due to racing. + */ + page_cma = is_migrate_cma_page(page); + pr_warn("%sflags: %pGp%s\n", type, &folio->flags, page_cma ? " CMA" : ""); - pr_warn("page_type: %pGt\n", &head->page_type); + pr_warn("page_type: %pGt\n", &folio->page.page_type); print_hex_dump(KERN_WARNING, "raw: ", DUMP_PREFIX_NONE, 32, sizeof(unsigned long), page, sizeof(struct page), false); - if (head != page) + if (folio_test_large(folio)) print_hex_dump(KERN_WARNING, "head: ", DUMP_PREFIX_NONE, 32, - sizeof(unsigned long), head, - sizeof(struct page), false); + sizeof(unsigned long), folio, + 2 * sizeof(struct page), false); +} + +static void __dump_page(const struct page *page) +{ + struct folio *foliop, folio; + struct page precise; + unsigned long pfn = page_to_pfn(page); + unsigned long idx, nr_pages = 1; + int loops = 5; + +again: + memcpy(&precise, page, sizeof(*page)); + foliop = page_folio(&precise); + idx = folio_page_idx(foliop, page); + if (idx != 0) { + if (idx < (1UL << PUD_ORDER)) { + memcpy(&folio, foliop, 2 * sizeof(struct page)); + nr_pages = folio_nr_pages(&folio); + } + + if (idx > nr_pages) { + if (loops-- > 0) + goto again; + printk("page does not match folio\n"); + precise.compound_head &= ~1UL; + foliop = (struct folio *)&precise; + idx = 0; + } + } + + __dump_folio(foliop, &precise, pfn, idx); } void dump_page(struct page *page, const char *reason) From patchwork Tue Feb 27 19:23:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13574326 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 5E491C5478C for ; Tue, 27 Feb 2024 19:23:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D52696B00E1; Tue, 27 Feb 2024 14:23:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CD19E6B00E2; Tue, 27 Feb 2024 14:23:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B55566B00E3; Tue, 27 Feb 2024 14:23:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 9C1CB6B00E1 for ; Tue, 27 Feb 2024 14:23:42 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7DF4680E0C for ; Tue, 27 Feb 2024 19:23:42 +0000 (UTC) X-FDA: 81838558284.24.F964A00 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf26.hostedemail.com (Postfix) with ESMTP id 0E749140010 for ; Tue, 27 Feb 2024 19:23:40 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=thp1A3US; spf=none (imf26.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709061821; 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=pXsu/Jnmrwq0LdFzV2fh7keOikBA6k2rhJnBe3lst/o=; b=8Plf08AC++we0fSCTaKGq3HapcBuwznxqZ04nEcfLF1E/3iH6cudv6TPqjSfDq1EH6Tlhm d6XhtjwRImUScEpQVpv1bsPd2DZt6Qzkn/grNyKxzlwOfr8ksX1hjpY5BwiMNFUZToQzdN IYVgVRXO1iyWOL8/k3EEQJ0+Vw+hfKc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709061821; a=rsa-sha256; cv=none; b=vgytq7UKWi+RcJADB00hYo4ZApoRbUY+/ZemgpyaPnEoAR1O9yqcbSbfctFeKt1jfucdhN nCShG2yVHNqkKBVtQdRvf4lmgoVGQnI3GkigkfV+W4SKWT4btS9aVdzWgGU+EYBjfULcro Tp1G5eNRfsn/WZnfWHFm0tlWWYIZ6Zo= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=thp1A3US; spf=none (imf26.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none 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=pXsu/Jnmrwq0LdFzV2fh7keOikBA6k2rhJnBe3lst/o=; b=thp1A3USB5F7BXqpQVn+f/c0ri XqIQP+F/aQpToft06NEsqygc/QYttQMnxgsJUOCAW+EJSgBP7NJp25hDFMluGBTg6p1YPaefv0Lt4 Rlv4OJLybtz4NkbOoo4Gd+17Dqe4r0rPGPPFSXVr18rUCEMlOy2osUxChwcOcOmqkZoayIDYh9Ahi 8U36zf3RE8xMf7pgs4w7eA+NfnZWzZzgfXHSne65K3ZdjpGkIe96hgG9y3ab212yTswycdGPORMrE uXdyUERK5i8E6NnhrsNJKPTmuSgbUzL5XUKAzW1r54l7J2yoE+mSmHplF6nWuV4kCmVl14XKOC3Fd DEszuBLg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rf33D-00000003B1H-1PtY; Tue, 27 Feb 2024 19:23:39 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 5/8] mm: Make dump_page() take a const argument Date: Tue, 27 Feb 2024 19:23:32 +0000 Message-ID: <20240227192337.757313-6-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-Stat-Signature: zd5a8b5aw4nd7cxqckx3ik3y6pgoxtaz X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 0E749140010 X-Rspam-User: X-HE-Tag: 1709061820-256466 X-HE-Meta: U2FsdGVkX199Ji7D6ZYe1PTDm45oJFeXFFJj3L2S5mEJ49JWg05xzUeZnfgvz8AQImVYfZ+EOntFQTMBkEtYWd4ik1oCQS4gwbOXrW/gGFtXl/JbdDQWKTYOozuqCnPx4oKLzbvv4k9yiu7ByFf2E6Nm/S9nrH0sg/71nwr/Ec++DDXkReIY8be/yyiNMOhkJFIuOTBJzzmyV5YXlb0pVaLT0MDZRFC18hBlk4fbUI6TcS6p8OwPL8DsjeR/8TbNnNLFOEZabX2DzkABu9nzph51VNQATfInYkNyzm9jevUJNZoO1xxpAkhmJJnd2qV/xpHWhfZlF2kgw5zecKOx5LRv1huJe5jNuA/a/MiJAk1t1qO3CYhwdhFHTF3b3q2rgumROgr+JJ3bjK9bB8Zn0OCENA3QpARUns9oNJ3RwqzH+rDeOkpZXZkw9TBSvVWh1yNmcrVQOjPGAiFnfsVWqbxyqXQkivBbSqcj0njL0VfFM/mpSwAm8pHqwMGSpPVH50/NhziJqXgJ/0DUdeau56IX00dP4A10vpYolPYEneEiUlhlS+/6MfZ+F2TyG1/urfxsVi7/IfmVaHCyTlyEjUpLORcasuH024ZoMGx10tMmF8vBIVprtPw/jKlBQMAlXqmOAxxBAQnYZEPHioYwajOXaHbJXLkyD3m8gDCOgZp9ZEkVW3ztGktjJWd/epvVfA/v5zHOlOJIQH1rU548+2NjcZlwewfxxWvvV8vCb5+4reOyW21AZEyLXGQRJvF5Y82D8eHdBPrOu4frMz1S85gbkvI1mKY+xXNJjTe9LtQRJQhX+pehMoHmnpeZSMM8y1SMud++V0Yoia1dzHS+aMnWhL1XPKnkXw4wLpF8EEPTjok8eWEahJAeNQwE+XvJPbJ87xceiZqP3mSPjbksXHM6IILg5GCG 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: Now that __dump_page() takes a const argument, we can make dump_page() take a const struct page too. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: David Hildenbrand --- include/linux/mmdebug.h | 2 +- mm/debug.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h index 7c3e7b0b0e8f..39a7714605a7 100644 --- a/include/linux/mmdebug.h +++ b/include/linux/mmdebug.h @@ -10,7 +10,7 @@ struct vm_area_struct; struct mm_struct; struct vma_iterator; -void dump_page(struct page *page, const char *reason); +void dump_page(const struct page *page, const char *reason); void dump_vma(const struct vm_area_struct *vma); void dump_mm(const struct mm_struct *mm); void vma_iter_dump_tree(const struct vma_iterator *vmi); diff --git a/mm/debug.c b/mm/debug.c index 96555fc78f1a..6149944016a7 100644 --- a/mm/debug.c +++ b/mm/debug.c @@ -143,7 +143,7 @@ static void __dump_page(const struct page *page) __dump_folio(foliop, &precise, pfn, idx); } -void dump_page(struct page *page, const char *reason) +void dump_page(const struct page *page, const char *reason) { if (PagePoisoned(page)) pr_warn("page:%p is uninitialized and poisoned", page); From patchwork Tue Feb 27 19:23:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13574327 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 BB15FC54798 for ; Tue, 27 Feb 2024 19:23:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 455276B00E9; Tue, 27 Feb 2024 14:23:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D2716B00ED; Tue, 27 Feb 2024 14:23:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 224E66B00E9; Tue, 27 Feb 2024 14:23:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id E530E6B00E3 for ; Tue, 27 Feb 2024 14:23:42 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A83A180E10 for ; Tue, 27 Feb 2024 19:23:42 +0000 (UTC) X-FDA: 81838558284.19.D69D5E4 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf19.hostedemail.com (Postfix) with ESMTP id 109A41A0014 for ; Tue, 27 Feb 2024 19:23:40 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=t53W7VHf; spf=none (imf19.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709061821; 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=FNPPeN942hbxsvA9N1gIHpI3nX27EjanohFk4jw9UuY=; b=poik5o6/AJAO5Mf8EEKCmthbuZjCaNBFqW/4FxkLchoQ264IYNbWIsWy3+owoX6gcZhe7f eryd7+gacLMCDiRjBcoN50kscsqZceUXobIkedM/ameEIocmm/CUw7zsY3MjdQLC5AoJAx r4lu3Xt446sPIVIqL//NNN1fAxyKpIM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709061821; a=rsa-sha256; cv=none; b=8nTt5VrR8CUcScqCllVKNfn2sVpnlLD1QiPt3NggoI4geTValEu6H0mNf5FrfUUgS0LAM/ EmWAAVtzqcH5luRfI+6cFXohjyxzwtDAGOAhzOnRhNIDuoiKXtrwkpxC7FTdE7HmI04HiR ehM5caWp9cvpZw1M+EJnRJ12YsDx2T4= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=t53W7VHf; spf=none (imf19.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none 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=FNPPeN942hbxsvA9N1gIHpI3nX27EjanohFk4jw9UuY=; b=t53W7VHffJpWuj199u0KM7wK8K GTlQoJXNyeyLLOo1jIXtIS8+5YxGpSK63kHEiBc4LNMEoUccn4OGVgclMkE6U8DxDbnhPfk8v143R xQYOFCYazgEF21NEI3p4LAOW00ExUXLNiBwfqJT/U1nNv6JajukW7UgtZgbzyeMERlQdSknaHVKin DgtPFfyeSBLW8tiiNznDu9Dk11N9NUkeu8wlPcastQTa4Fz+AkYDJM5/D/iwAC4nSQC5hwN/BfzZp YSjrQ5wBg381NLXkXWoI+JxXxVkvkbio3MkD9M9PR9sRfcYds+HEx80Aprgoi0hV+qC5oiCeVfkgh WZLk4l0Q==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rf33D-00000003B1S-1uUA; Tue, 27 Feb 2024 19:23:39 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 6/8] mm: Constify testing page/folio flags Date: Tue, 27 Feb 2024 19:23:33 +0000 Message-ID: <20240227192337.757313-7-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-Stat-Signature: ugb6hqm5phugozmrsu9jnk4eioow5bh8 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 109A41A0014 X-Rspam-User: X-HE-Tag: 1709061820-679269 X-HE-Meta: U2FsdGVkX19vyxu9Po1B6c0aCs7AMzWtLDNHfsqvNcAFMmbahpjW8EAnGDJ4ycbPI/sM4HFCPRFLQXnOTDUz5qWU/8BLoUXulTL73ntIa+U2MtYN+fMZt37sKzM1NVbf5T2oNG86dtwA605Epa3UvJcOBOQQvutGjPQst+9+EldMRzEHPUaTtRHdMGekEVmlh0UL60NWEmTj7BuOiYKpoHrQcURzp3WZ5VbNi/2PDFiwIGsI9Nf5QITbdPolMLzrsK7Kyxzs+6z5tZUcjbuEm6tuzimxI4kUBIc37AP7es+/PfOXk0sFrvPYis/Db2Q4o5mBOQRmaCX+34875fQXe0wbbXTMbxrvUK+gp8z6yJ8cwJbZLnKh6bGdMESYj9Wmo4dyiRcNk3d6P6sXMC7NlfmcU9IAsXtfIj+502BVfn0ex9n1xTkk4mrLoH2fLOZan1ebU534/OKTXTaMCzHMCnCIkl4Z74WSW28lA+flIatTpo+nCPZ6aIC6g2VHwv/WQW2bOIWGP8vilNeAOO1L44Ux3r0P7uNA3MqFOfl+lur8MjN5wXL9cxX4pu0tCWSbOo6fBiaW85AC+n/MDnhoHEmYoEHq3hBNTvC5e31lxKJuh0XA8+v8jB8BlvX9cZe+L53X2vrsrNaEfWWhZgY1ZkQBdL75kaUEEw1a+mSseRSdEXGbHbmkGIqs0ECIVk00STcaCZFW9WwfzHkq4uFlCiE1+j1Ow5cNfIt6y/tz7ukCtSRYKTkwU9irgIa3VHaxb6Py8VVcMRaWvSXV7/as76Xit3IbZKe8Q0PkcJjAAXdIO78sLbGj6uSsA9mphmgYYEo4cw8OyI/CPi0qOqoLfhjsUnQLdeRd8XEBcV/sS4bagwmhsgSvCCx3o0giuy+3wrUQkF40jbQR8rX5t22VqRnUJVbdRAbrjvc+E4f9qnL90vwd2R998Mqq+F+mN8+S6uH0mPc7TAdgYFPZsiH 7lT9bl1z 9DUXs8y44DxMwOqudOL+DRRzjakT+oFlx2/kyvGk3eQC1aAYeL3OM5Gfge458xvX3zwhiVj9KDKs+xgS/KDsOIQgOgqOpkx3Ab5A0UiJCjaaesOfw0/o/j2dd8eYb9qNIFqKSMxJeP0xFhjUgav4OKvF3ajWRIS56jt10ugjSrJR/tvq0UEh3zc2oqQ== 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: Now that dump_page() takes a const argument, we can constify all the page flag tests. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: David Hildenbrand --- include/linux/page-flags.h | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 582ca7400eca..3463cd1baebf 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -237,7 +237,7 @@ static inline const struct page *page_fixed_fake_head(const struct page *page) } #endif -static __always_inline int page_is_fake_head(struct page *page) +static __always_inline int page_is_fake_head(const struct page *page) { return page_fixed_fake_head(page) != page; } @@ -281,12 +281,12 @@ static inline unsigned long _compound_head(const struct page *page) */ #define folio_page(folio, n) nth_page(&(folio)->page, n) -static __always_inline int PageTail(struct page *page) +static __always_inline int PageTail(const struct page *page) { return READ_ONCE(page->compound_head) & 1 || page_is_fake_head(page); } -static __always_inline int PageCompound(struct page *page) +static __always_inline int PageCompound(const struct page *page) { return test_bit(PG_head, &page->flags) || READ_ONCE(page->compound_head) & 1; @@ -306,6 +306,16 @@ static inline void page_init_poison(struct page *page, size_t size) } #endif +static const unsigned long *const_folio_flags(const struct folio *folio, + unsigned n) +{ + const struct page *page = &folio->page; + + VM_BUG_ON_PGFLAGS(PageTail(page), page); + VM_BUG_ON_PGFLAGS(n > 0 && !test_bit(PG_head, &page->flags), page); + return &page[n].flags; +} + static unsigned long *folio_flags(struct folio *folio, unsigned n) { struct page *page = &folio->page; @@ -367,8 +377,8 @@ static unsigned long *folio_flags(struct folio *folio, unsigned n) * 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)); } +static __always_inline bool folio_test_##name(const struct folio *folio) \ +{ return test_bit(PG_##name, const_folio_flags(folio, page)); } #define FOLIO_SET_FLAG(name, page) \ static __always_inline void folio_set_##name(struct folio *folio) \ @@ -401,7 +411,7 @@ FOLIO_CLEAR_FLAG(name, page) #define TESTPAGEFLAG(uname, lname, policy) \ FOLIO_TEST_FLAG(lname, FOLIO_##policy) \ -static __always_inline int Page##uname(struct page *page) \ +static __always_inline int Page##uname(const struct page *page) \ { return test_bit(PG_##lname, &policy(page, 0)->flags); } #define SETPAGEFLAG(uname, lname, policy) \ @@ -801,7 +811,7 @@ static __always_inline bool folio_test_head(struct folio *folio) return test_bit(PG_head, folio_flags(folio, FOLIO_PF_ANY)); } -static __always_inline int PageHead(struct page *page) +static __always_inline int PageHead(const struct page *page) { PF_POISONED_CHECK(page); return test_bit(PG_head, &page->flags) && !page_is_fake_head(page); From patchwork Tue Feb 27 19:23:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13574332 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 1A9CAC5478C for ; Tue, 27 Feb 2024 19:23:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C132F6B00F6; Tue, 27 Feb 2024 14:23:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B73896B0103; 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 930D228000B; Tue, 27 Feb 2024 14:23:44 -0500 (EST) 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 618326B00F6 for ; Tue, 27 Feb 2024 14:23:44 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3BE18A132C for ; Tue, 27 Feb 2024 19:23:44 +0000 (UTC) X-FDA: 81838558368.03.0F4CF92 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf26.hostedemail.com (Postfix) with ESMTP id AC837140008 for ; Tue, 27 Feb 2024 19:23:42 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=bCmLRwfe; spf=none (imf26.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none 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=a3ZTH8nL1tyaewAJnOApG6Iuk7ZCfPQQszhrvLxioIY=; b=f3D9Zv33EvNXJFZTvrotSJFT7J9vlyii0aqiEFNnE4wwGcfiD40ZUz3yYIB1HbkeJ4+L5+ lbrdXDf1Ax2SZvYcBgyzvMOZ026D7LH2BFiKYkk3Wu6c+6Vm0MXnyQeI/8potI8Cj4QS6c dEyXkYZbdx6zoI7H710ZBEV3nhJekSU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709061822; a=rsa-sha256; cv=none; b=Ir9RYXuxJ7kBnoww0jPZTrxVwjPeUgj9XGyu3W44Ds6MWM8FXS68xrPhGjWB4MVaf34/o4 K7iY+OxACKokTIdSZedhOwMHpAmZbwLjvA2P0KDVG/qSGnAuMFF21zR5r6/21tq+JuNYdJ ex88uPvPtsSI1iEwXT+kobTw0L5cA1Y= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=bCmLRwfe; spf=none (imf26.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none 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=a3ZTH8nL1tyaewAJnOApG6Iuk7ZCfPQQszhrvLxioIY=; b=bCmLRwfe7wegiAzQT8MPjfec89 S19NY6XMcnZ5VBeUvQzDwk2WCq0770wuhN2vIzU8HhgcatGVYrhEq8RSefysoU7Y7g/oBcKRETvJP e4nNUXkgMl9XPKrXQ7zRfWmrR6wVGLs02/e80VhF7eWNrVmaINzI4V2Yt6V8oFMVl/RiwM+DFv552 pr1DlDWTSvuQgF69977Ajwl4AO4s/td9SoG3LQKx/S1UTQy0Q5+zlpcsNBmTTqVLjBcn/qveJeBup IsEnxPFX7vatH67xDum6A3GDOEBs6EiJPsxK9wVPO8oehN3YSqMdLQ9+rRPu+MTAWWNZWRHOzKDuS FCNLFWQQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rf33D-00000003B1Y-2cqL; Tue, 27 Feb 2024 19:23:39 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 7/8] mm: Constify more page/folio tests Date: Tue, 27 Feb 2024 19:23:34 +0000 Message-ID: <20240227192337.757313-8-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-Stat-Signature: tcg31eeia5o3exg5r8bg3jhh9tbwjzjg X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: AC837140008 X-Rspam-User: X-HE-Tag: 1709061822-481152 X-HE-Meta: U2FsdGVkX19nfXh1yAAKsG/tYjWo4GGH5gL426SLUhg+vJaCFxTDYqJO/uKAH55dnnWQO2jpN99bqo6Xa8PkIdUxjOHbfE0nZl5uKcWSu/geEdDC0DqHEpILq6SbHcqG99IS3/Jutu6jspaeIw32AA8nOQIF/p3HvlnRgm+3/SFSTNQ1PQOd5YdMv/f1oD2SjaGoyslzrK48b1aErwDKotrLLJhKaB2hZRDwSXGcyG2Dzui08ibWTd4kI0ivOP5gf0e8DuOJPlpfel7C+ULhgaDgwQ8BOHuSY683v6/WnqnG472pg5u8dPCckYL33FODPbTUxYjdkfXtyvEDa6l9E+cPCuHHKex7C83JrPQHrDRwq0+GcM/OTYf/lr28CcEGTXHYfYdiSPAeINEouFc5otzIqh9JyoQJEaRNrOG9ro73stnQCmPrpWur244tUhU3JiluH6em9FiVxQOnAx7BhFdLrsfFHG80AXJz+4ifBKoQXZDnmPxJe9lPrDEGUsNAJu9icIRm/jDz+gRJwFi5ZcXphlIPUoP6yTm5D1HNXiB2SNi9C0/gW3x4VY2B8amkkMTWRWYhnuJn18CY7yrlsyVH37UlvwX7ergNunU5+UHKxnpooC/428oh+oHnJySYARF7BqDc0H/XgOL51nbN/eDZIS65M4R1jNLDPzmy9BL1hIoyTshnqM/N0aBtWL10qxjUThbkG5QuocnWDo6WkOfP+o8N0GOKTqIrGVPbV2uprxj1moqedL8wcI23LEkZFQDJhGVb0O3mPaFIbxfeLjLbzBLMxyOhA3yO/Lrey/jU2/71EkvV/2Sl5Z+V1hMd55usO1prhTIFo6hOx/jyExg9Az1+nwe6rbHqm/PBZgAKaKfQ8UG8xQ== 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: Constify the flag tests that aren't automatically generated and the tests that look like flag tests but are more complicated. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: David Hildenbrand --- include/linux/page-flags.h | 52 +++++++++++++++++++------------------- mm/hugetlb.c | 4 +-- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 3463cd1baebf..652d77805e99 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -558,13 +558,13 @@ PAGEFLAG_FALSE(HighMem, highmem) #endif #ifdef CONFIG_SWAP -static __always_inline bool folio_test_swapcache(struct folio *folio) +static __always_inline bool folio_test_swapcache(const struct folio *folio) { return folio_test_swapbacked(folio) && - test_bit(PG_swapcache, folio_flags(folio, 0)); + test_bit(PG_swapcache, const_folio_flags(folio, 0)); } -static __always_inline bool PageSwapCache(struct page *page) +static __always_inline bool PageSwapCache(const struct page *page) { return folio_test_swapcache(page_folio(page)); } @@ -663,22 +663,22 @@ PAGEFLAG_FALSE(VmemmapSelfHosted, vmemmap_self_hosted) */ #define PAGE_MAPPING_DAX_SHARED ((void *)0x1) -static __always_inline bool folio_mapping_flags(struct folio *folio) +static __always_inline bool folio_mapping_flags(const struct folio *folio) { return ((unsigned long)folio->mapping & PAGE_MAPPING_FLAGS) != 0; } -static __always_inline int PageMappingFlags(struct page *page) +static __always_inline int PageMappingFlags(const struct page *page) { return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) != 0; } -static __always_inline bool folio_test_anon(struct folio *folio) +static __always_inline bool folio_test_anon(const struct folio *folio) { return ((unsigned long)folio->mapping & PAGE_MAPPING_ANON) != 0; } -static __always_inline bool PageAnon(struct page *page) +static __always_inline bool PageAnon(const struct page *page) { return folio_test_anon(page_folio(page)); } @@ -689,7 +689,7 @@ static __always_inline bool __folio_test_movable(const struct folio *folio) PAGE_MAPPING_MOVABLE; } -static __always_inline int __PageMovable(struct page *page) +static __always_inline int __PageMovable(const struct page *page) { return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) == PAGE_MAPPING_MOVABLE; @@ -702,13 +702,13 @@ static __always_inline int __PageMovable(struct page *page) * is found in VM_MERGEABLE vmas. It's a PageAnon page, pointing not to any * anon_vma, but to that page's node of the stable tree. */ -static __always_inline bool folio_test_ksm(struct folio *folio) +static __always_inline bool folio_test_ksm(const struct folio *folio) { return ((unsigned long)folio->mapping & PAGE_MAPPING_FLAGS) == PAGE_MAPPING_KSM; } -static __always_inline bool PageKsm(struct page *page) +static __always_inline bool PageKsm(const struct page *page) { return folio_test_ksm(page_folio(page)); } @@ -747,9 +747,9 @@ static inline bool folio_xor_flags_has_waiters(struct folio *folio, * some of the bytes in it may be; see the is_partially_uptodate() * address_space operation. */ -static inline bool folio_test_uptodate(struct folio *folio) +static inline bool folio_test_uptodate(const struct folio *folio) { - bool ret = test_bit(PG_uptodate, folio_flags(folio, 0)); + bool ret = test_bit(PG_uptodate, const_folio_flags(folio, 0)); /* * Must ensure that the data we read out of the folio is loaded * _after_ we've loaded folio->flags to check the uptodate bit. @@ -764,7 +764,7 @@ static inline bool folio_test_uptodate(struct folio *folio) return ret; } -static inline int PageUptodate(struct page *page) +static inline int PageUptodate(const struct page *page) { return folio_test_uptodate(page_folio(page)); } @@ -806,9 +806,9 @@ void set_page_writeback(struct page *page); #define folio_start_writeback_keepwrite(folio) \ __folio_start_writeback(folio, true) -static __always_inline bool folio_test_head(struct folio *folio) +static __always_inline bool folio_test_head(const struct folio *folio) { - return test_bit(PG_head, folio_flags(folio, FOLIO_PF_ANY)); + return test_bit(PG_head, const_folio_flags(folio, FOLIO_PF_ANY)); } static __always_inline int PageHead(const struct page *page) @@ -827,7 +827,7 @@ CLEARPAGEFLAG(Head, head, PF_ANY) * * Return: True if the folio is larger than one page. */ -static inline bool folio_test_large(struct folio *folio) +static inline bool folio_test_large(const struct folio *folio) { return folio_test_head(folio); } @@ -856,7 +856,7 @@ TESTPAGEFLAG_FALSE(LargeRmappable, large_rmappable) #define PG_head_mask ((1UL << PG_head)) #ifdef CONFIG_HUGETLB_PAGE -int PageHuge(struct page *page); +int PageHuge(const struct page *page); SETPAGEFLAG(HugeTLB, hugetlb, PF_SECOND) CLEARPAGEFLAG(HugeTLB, hugetlb, PF_SECOND) @@ -869,10 +869,10 @@ CLEARPAGEFLAG(HugeTLB, hugetlb, PF_SECOND) * Return: True for hugetlbfs folios, false for anon folios or folios * belonging to other filesystems. */ -static inline bool folio_test_hugetlb(struct folio *folio) +static inline bool folio_test_hugetlb(const struct folio *folio) { return folio_test_large(folio) && - test_bit(PG_hugetlb, folio_flags(folio, 1)); + test_bit(PG_hugetlb, const_folio_flags(folio, 1)); } #else TESTPAGEFLAG_FALSE(Huge, hugetlb) @@ -887,7 +887,7 @@ TESTPAGEFLAG_FALSE(Huge, hugetlb) * hugetlbfs pages, but not normal pages. PageTransHuge() can only be * called only in the core VM paths where hugetlbfs pages can't exist. */ -static inline int PageTransHuge(struct page *page) +static inline int PageTransHuge(const struct page *page) { VM_BUG_ON_PAGE(PageTail(page), page); return PageHead(page); @@ -898,7 +898,7 @@ static inline int PageTransHuge(struct page *page) * and hugetlbfs pages, so it should only be called when it's known * that hugetlbfs pages aren't involved. */ -static inline int PageTransCompound(struct page *page) +static inline int PageTransCompound(const struct page *page) { return PageCompound(page); } @@ -908,7 +908,7 @@ static inline int PageTransCompound(struct page *page) * and hugetlbfs pages, so it should only be called when it's known * that hugetlbfs pages aren't involved. */ -static inline int PageTransTail(struct page *page) +static inline int PageTransTail(const struct page *page) { return PageTail(page); } @@ -972,7 +972,7 @@ static inline int page_type_has_type(unsigned int page_type) return (int)page_type < PAGE_MAPCOUNT_RESERVE; } -static inline int page_has_type(struct page *page) +static inline int page_has_type(const struct page *page) { return page_type_has_type(page->page_type); } @@ -1056,7 +1056,7 @@ extern bool is_free_buddy_page(struct page *page); PAGEFLAG(Isolated, isolated, PF_ANY); -static __always_inline int PageAnonExclusive(struct page *page) +static __always_inline int PageAnonExclusive(const struct page *page) { VM_BUG_ON_PGFLAGS(!PageAnon(page), page); VM_BUG_ON_PGFLAGS(PageHuge(page) && !PageHead(page), page); @@ -1129,12 +1129,12 @@ static __always_inline void __ClearPageAnonExclusive(struct page *page) * Determine if a page has private stuff, indicating that release routines * should be invoked upon it. */ -static inline int page_has_private(struct page *page) +static inline int page_has_private(const struct page *page) { return !!(page->flags & PAGE_FLAGS_PRIVATE); } -static inline bool folio_has_private(struct folio *folio) +static inline bool folio_has_private(const struct folio *folio) { return page_has_private(&folio->page); } diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 418d66953224..bb17e5c22759 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2164,9 +2164,9 @@ static bool prep_compound_gigantic_folio_for_demote(struct folio *folio, * transparent huge pages. See the PageTransHuge() documentation for more * details. */ -int PageHuge(struct page *page) +int PageHuge(const struct page *page) { - struct folio *folio; + const struct folio *folio; if (!PageCompound(page)) return 0; From patchwork Tue Feb 27 19:23:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13574328 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 1FE56C5478C for ; Tue, 27 Feb 2024 19:23:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 764996B00E2; Tue, 27 Feb 2024 14:23:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 538A76B00E6; Tue, 27 Feb 2024 14:23:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 30EA56B00E8; Tue, 27 Feb 2024 14:23:43 -0500 (EST) 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 03D336B00E2 for ; Tue, 27 Feb 2024 14:23:43 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B5DD0160D95 for ; Tue, 27 Feb 2024 19:23:42 +0000 (UTC) X-FDA: 81838558284.18.D786529 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf24.hostedemail.com (Postfix) with ESMTP id 27F0A180017 for ; Tue, 27 Feb 2024 19:23:40 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=aDgY2KhC; spf=none (imf24.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709061821; 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=W6fqlZ27VH1xlFaJzL8Rx+tU9gk2VjOfdXBM9h+YOHM=; b=Nt8zRkv+5eTO4nZUDVdgu/BRqmcbwoEz+Ug2DlhsXUTR1J1M8FXEdHNnwZ/+403g6fns42 gZBS7jy2Kb57A+xqbnu33YZcap6Ty4M0fTdC5t+t1j6FQ3qCgAM1g6pfghMBHedRifDgr3 PAKAYDpIjgYaOVCpCiI7eakjoddVjC4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709061821; a=rsa-sha256; cv=none; b=q6UP7jI35qiOYVHMk4eT4C96Z1LH1fZDXa790o80dGgN2yfxTq7aooF2Y1ZDc6cm66rgu/ 5s7iInxn2Agx4WuRrsaVpoDHyGkeOYNAD8IjQNsWihTPL/EH4OQE6fK04ln74pdqJNXRm8 teXJw5flipszOmrdXxhDdLGkrsKt9v8= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=aDgY2KhC; spf=none (imf24.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none 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=W6fqlZ27VH1xlFaJzL8Rx+tU9gk2VjOfdXBM9h+YOHM=; b=aDgY2KhCpTWgazJCsj6Q6S3FYl FixRVTvn8Lphqwv4wDh5RJUgf9uMnmBRBYnzsl9GJzkR5a0YCUxYC/DYE0dQl/cfMFJNP9+u6KfBp puBCSjty9sdAL4XywUvW711/EUSpzsK+589sPnkeXObHxRo8etgf7nmHl7s0squdY7mFaW/LDg4Or IaZGAUWCbBsexdadloB8VwtDBhKNqGM1ZirsYoc3dpCj9tbdi/BrKdWM9ffUbhLKWYPfLUKsPsiHo maamfnZobJQXkXhpOD3ieu16n/PKBh7/SZV1kV16VGCO/T6ZvAQepKE2S3738S9i5y9/RCoTiNUuR 8VFWofKA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rf33D-00000003B1i-3Hod; Tue, 27 Feb 2024 19:23:39 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 8/8] mm: Remove cast from page_to_nid() Date: Tue, 27 Feb 2024 19:23:35 +0000 Message-ID: <20240227192337.757313-9-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-Stat-Signature: 6i4jgha678emxuki6wzdi35hftnpxpgw X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 27F0A180017 X-Rspam-User: X-HE-Tag: 1709061820-150406 X-HE-Meta: U2FsdGVkX19jMbykLxPDR2BIaapJ5Ujc6dYBf57SDqwuQSxyeGRB3G8FgpKGKjClJUFkt+QCBMX/Cu1VzWWAynGfjmoSNBE2kSQSDsujiYOA6ZKcE4twCkgZDtCJzSryGcvv1MAo438OGbXDpJnZKPlYmg9HH5knLeeJE3YjqhDSb25YOV+rDncK1Yed5dHE7wz7RTUbPeWEZuZdFuk2qonQvh8TG7KknC/lA4FdOw0C7EGVUsixcOLGQbfnG6hlgN5PPPTdGtCS5f+BuMQkArsI3jjrMzXVyRmMn3Bt6qmCUUKe6ZWrdm9otmGyT1rieWAgvnbhlH2dZ0J+pm4/xjKt/aZbMPz3psl1bylsl70S/gAI1/Tl4UzdDOHOdmRTJwv15k4Ath7d3xkYbGwKLBNf3tsfKNa03kLDErEEuB0PIaG0JPdrMLjSjvMa9ZZSuTYbJ8wKS36JhSF0JMhQGF9rAHGS4nH5WsWzyoxkiTNp8QxevVKItknmc5Zo1tqNjpjikqIUqvJKPWv6an2b9TowReCZF8j7JYo+pVTR1uaOY/XlyBJ8iqUIM/1kH8iubXcf5rIPXykO4Ykswt5RoSnnnBUbJJDQcE5JzPZYjBLtzPU6tYCxdiH/yCHRhdfdkT/RpOFh42S5G9QWV+8haxQbnXZu+b4rbR4jWreIF3TKLI/rZIBi5fmu5UcQ70WZHr4qmr9PPzPqXSSzPkr20z8dND0XYm6fKHt/Ky256tMuNGm67RJFScb+0UBVcjs3c5pYOfIUpBWbawIaSaCoZdAq6w8cijZEhgJXZAD4lIf1GYSvk/VqUtl99SH09vcgbDRk1kpR3IP0R6KZnGkCaGhBol2Igu/XjchHSM540O7Gg5c/n9z8fayXOxJ7QHreeIRii0S9L7sKCZWOT+AfWvffiLbD68eh 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: Now that PF_POISONED_CHECK() can take a const argument, we can drop the cast. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: David Hildenbrand --- include/linux/mm.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index c4a76520c967..21a8cfbe75aa 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1662,13 +1662,11 @@ static inline int page_zone_id(struct page *page) } #ifdef NODE_NOT_IN_PAGE_FLAGS -extern int page_to_nid(const struct page *page); +int page_to_nid(const struct page *page); #else static inline int page_to_nid(const struct page *page) { - struct page *p = (struct page *)page; - - return (PF_POISONED_CHECK(p)->flags >> NODES_PGSHIFT) & NODES_MASK; + return (PF_POISONED_CHECK(page)->flags >> NODES_PGSHIFT) & NODES_MASK; } #endif