Skip to contentSkip to conversation

mm-convert-folio_page-back-to-a-macro.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Sep 28, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: convert folio_page() back to a macro
has been removed from the -mm tree. Its filename was
mm-convert-folio_page-back-to-a-macro.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: David Hildenbrand <[email protected]>
Subject: mm: convert folio_page() back to a macro
Date: Tue, 23 Sep 2025 16:00:58 +0200

In commit 73b3294b1152 ("mm: simplify folio_page() and folio_page_idx()") we converted folio_page() into a static inline function. However briefly afterwards in commit a847b17009ec ("mm: constify highmem related functions for improved const-correctness") we had to add some nasty const-away casting to make the compiler happy when checking const correctness.

So let's just convert it back to a simple macro so the compiler can check const correctness properly. There is the alternative of using a _Generic() similar to page_folio(), but there is not a lot of benefit compared to just using a simple macro.

---

 include/linux/page-flags.h |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
include/linux/page-flags.h renamed from include/linux/page-flags.h~mm-convert-folio_page-back-to-a-macro +1 -4
@@ -316,10 +316,7 @@ static __always_inline unsigned long _co
  * check that the page number lies within @folio; the caller is presumed
  * to have a reference to the page.
  */
-static inline struct page *folio_page(const struct folio *folio, unsigned long n)
-{
-	return (struct page *)(&folio->page + n);
-}
+#define folio_page(folio, n)	(&(folio)->page + (n))
 
 static __always_inline int PageTail(const struct page *page)
 {

_

Patches currently in -mm which might be from [email protected] are