From nobody Sat Feb 7 20:58:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F3713A0E84; Thu, 15 Jan 2026 14:46:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768488377; cv=none; b=rM/nH4WOhbxUbKJ/PMQTz2cz51n0dqTmQIOjrodcYJ4GpYI3z7fgb5w5g0f8HeAEEfKoKaYSgGldejQnOwpozmKsJfcw+OG2asOeoCGRDbeBdsAAdlBjlNWGypgogtG3MuyKxtlK3twJuovxadOU8ueM+OVgadY/aZoHdIMPxWk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768488377; c=relaxed/simple; bh=USgADkH2vXFF+KeppM0w/kcZpZeTOtI5OuFJPC+VuNA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S+ppGzgiuv7FRAwrIe4Sm1cBK+9coVuedlNcBLsDoM0fEEUKRWJyv+uNay7QaNQVCDecy5tDhhOF79zDOcE6u+aAdY4ogNLP8svM1ImJC/uZKJbkhutHJbJT/QOQom1jAcfdEoZmsMIMwIk5XbCoAF1Z14jUhxNSSCoXKN71dFU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lRTf9nDk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lRTf9nDk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B44AC4AF09; Thu, 15 Jan 2026 14:46:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768488374; bh=USgADkH2vXFF+KeppM0w/kcZpZeTOtI5OuFJPC+VuNA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lRTf9nDkDZh3WnVifpgG0nhelTmx/1Uky6SnoMxTaWq3FZxYnhkVheRyuzDybzdRU hCRseGVBIhmX0BH3gkJCZiUvpLTmfz/G9mlI5gxLwZ1wAAp4tzbq0BsbKURTFK0a+M X9gfv2n4AWVdMVYUeBTMmZJOnDYn5xqigmsOVtPPEKz9EGhCdyBMUtkWEn+O4UdXVr oZZct2Xkyuzw2nuqObAXVOQVkVsMjTKTUbgTK8jAZvwgJSomDG+89389S1xZwCO+1g X6lyL1AKbotHT0M4zxlnghKSaWBFYOedvWNYvB3MIUE/KtHVn1EVkDyL2lczPqcBd5 6jVNvw/MBK/Ww== Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfauth.phl.internal (Postfix) with ESMTP id A959BF40068; Thu, 15 Jan 2026 09:46:12 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Thu, 15 Jan 2026 09:46:12 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduvdeifeefucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepmfhirhihlhcu ufhhuhhtshgvmhgruhcuoehkrghssehkvghrnhgvlhdrohhrgheqnecuggftrfgrthhtvg hrnhephfdufeejhefhkedtuedvfeevjeffvdfhvedtudfgudffjeefieekleehvdetvdev necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepkhhirh hilhhlodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdduieduudeivdeiheeh qddvkeeggeegjedvkedqkhgrsheppehkvghrnhgvlhdrohhrghesshhhuhhtvghmohhvrd hnrghmvgdpnhgspghrtghpthhtohepvddtpdhmohguvgepshhmthhpohhuthdprhgtphht thhopegrkhhpmheslhhinhhugidqfhhouhhnuggrthhiohhnrdhorhhgpdhrtghpthhtoh epmhhutghhuhhnrdhsohhngheslhhinhhugidruggvvhdprhgtphhtthhopegurghvihgu sehkvghrnhgvlhdrohhrghdprhgtphhtthhopeifihhllhihsehinhhfrhgruggvrggurd horhhgpdhrtghpthhtohepuhhsrghmrggrrhhifheigedvsehgmhgrihhlrdgtohhmpdhr tghpthhtohepfhhvughlsehgohhoghhlvgdrtghomhdprhgtphhtthhopehoshgrlhhvrg guohhrsehsuhhsvgdruggvpdhrtghpthhtoheprhhpphhtsehkvghrnhgvlhdrohhrghdp rhgtphhtthhopehvsggrsghkrgesshhushgvrdgtii X-ME-Proxy: Feedback-ID: i10464835:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 15 Jan 2026 09:46:12 -0500 (EST) From: Kiryl Shutsemau To: Andrew Morton , Muchun Song , David Hildenbrand , Matthew Wilcox , Usama Arif , Frank van der Linden Cc: Oscar Salvador , Mike Rapoport , Vlastimil Babka , Lorenzo Stoakes , Zi Yan , Baoquan He , Michal Hocko , Johannes Weiner , Jonathan Corbet , kernel-team@meta.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Kiryl Shutsemau Subject: [PATCHv3 02/15] mm: Move MAX_FOLIO_ORDER definition to mmzone.h Date: Thu, 15 Jan 2026 14:45:48 +0000 Message-ID: <20260115144604.822702-3-kas@kernel.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20260115144604.822702-1-kas@kernel.org> References: <20260115144604.822702-1-kas@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Move MAX_FOLIO_ORDER definition from mm.h to mmzone.h. This is preparation for adding the vmemmap_tails array to struct pglist_data, which requires MAX_FOLIO_ORDER to be available in mmzone.h. Signed-off-by: Kiryl Shutsemau Acked-by: David Hildenbrand (Red Hat) --- include/linux/mm.h | 31 ------------------------------- include/linux/mmzone.h | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 7c79b3369b82..2c409f583569 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -2074,36 +2073,6 @@ static inline unsigned long folio_nr_pages(const str= uct folio *folio) return folio_large_nr_pages(folio); } =20 -#if !defined(CONFIG_HAVE_GIGANTIC_FOLIOS) -/* - * We don't expect any folios that exceed buddy sizes (and consequently - * memory sections). - */ -#define MAX_FOLIO_ORDER MAX_PAGE_ORDER -#elif defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) -/* - * Only pages within a single memory section are guaranteed to be - * contiguous. By limiting folios to a single memory section, all folio - * pages are guaranteed to be contiguous. - */ -#define MAX_FOLIO_ORDER PFN_SECTION_SHIFT -#elif defined(CONFIG_HUGETLB_PAGE) -/* - * There is no real limit on the folio size. We limit them to the maximum = we - * currently expect (see CONFIG_HAVE_GIGANTIC_FOLIOS): with hugetlb, we ex= pect - * no folios larger than 16 GiB on 64bit and 1 GiB on 32bit. - */ -#define MAX_FOLIO_ORDER get_order(IS_ENABLED(CONFIG_64BIT) ? SZ_16G : SZ_= 1G) -#else -/* - * Without hugetlb, gigantic folios that are bigger than a single PUD are - * currently impossible. - */ -#define MAX_FOLIO_ORDER PUD_ORDER -#endif - -#define MAX_FOLIO_NR_PAGES (1UL << MAX_FOLIO_ORDER) - /* * compound_nr() returns the number of pages in this potentially compound * page. compound_nr() can be called on a tail page, and is defined to diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 7fb7331c5725..6a2f3696068e 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -21,8 +21,10 @@ #include #include #include +#include #include #include +#include #include =20 /* Free memory management - zoned buddy allocator. */ @@ -61,6 +63,36 @@ */ #define PAGE_ALLOC_COSTLY_ORDER 3 =20 +#if !defined(CONFIG_HAVE_GIGANTIC_FOLIOS) +/* + * We don't expect any folios that exceed buddy sizes (and consequently + * memory sections). + */ +#define MAX_FOLIO_ORDER MAX_PAGE_ORDER +#elif defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) +/* + * Only pages within a single memory section are guaranteed to be + * contiguous. By limiting folios to a single memory section, all folio + * pages are guaranteed to be contiguous. + */ +#define MAX_FOLIO_ORDER PFN_SECTION_SHIFT +#elif defined(CONFIG_HUGETLB_PAGE) +/* + * There is no real limit on the folio size. We limit them to the maximum = we + * currently expect (see CONFIG_HAVE_GIGANTIC_FOLIOS): with hugetlb, we ex= pect + * no folios larger than 16 GiB on 64bit and 1 GiB on 32bit. + */ +#define MAX_FOLIO_ORDER get_order(IS_ENABLED(CONFIG_64BIT) ? SZ_16G : SZ_= 1G) +#else +/* + * Without hugetlb, gigantic folios that are bigger than a single PUD are + * currently impossible. + */ +#define MAX_FOLIO_ORDER PUD_ORDER +#endif + +#define MAX_FOLIO_NR_PAGES (1UL << MAX_FOLIO_ORDER) + enum migratetype { MIGRATE_UNMOVABLE, MIGRATE_MOVABLE, --=20 2.51.2