From: Nilay Vaish <nilayvaish@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Matthew Wilcox <willy@infradead.org>,
David Hildenbrand <david@kernel.org>,
Greg Thelen <gthelen@google.com>,
Roman Gushchin <kfree@google.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Nilay Vaish <nilayvaish@google.com>
Subject: [PATCH 03/15] mm/huge_memory: use folio_page() in THP split paths
Date: Tue, 29 Sep 2026 14:51:54 -0700 [thread overview]
Message-ID: <20260929215206.516490-4-nilayvaish@google.com> (raw)
In-Reply-To: <20260929215206.516490-1-nilayvaish@google.com>
As part of the memdescs effort, struct folio will be allocated
separately from struct page and will no longer overlay the head page.
Replace direct &folio->page uses and pointer arithmetic with
folio_page() in __split_folio_to_order(), __split_frozen_folio(),
folio_split_unmapped(), __split_huge_page_to_list_to_order(),
folio_split(), and split_folio_to_list().
No functional change intended.
Assisted-by: LLM
Signed-off-by: Nilay Vaish <nilayvaish@google.com>
---
mm/huge_memory.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 31af817eeded..58fbc4d4ddb8 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -3711,7 +3711,7 @@ static void __split_folio_to_order(struct folio *folio, int old_order,
* the flags from the original folio.
*/
for (i = new_nr_pages; i < nr_pages; i += new_nr_pages) {
- struct page *new_head = &folio->page + i;
+ struct page *new_head = folio_page(folio, i);
/*
* Careful: new_folio is not a "real" folio before we cleared PageTail.
* Don't pass it around before clear_compound_head().
@@ -3808,7 +3808,7 @@ static void __split_folio_to_order(struct folio *folio, int old_order,
if (new_order)
folio_set_order(folio, new_order);
else
- ClearPageCompound(&folio->page);
+ ClearPageCompound(folio_page(folio, 0));
}
/**
@@ -3898,7 +3898,7 @@ static int __split_frozen_folio(struct folio *folio, int new_order,
}
folio_split_memcg_refs(folio, old_order, split_order);
- split_page_owner(&folio->page, old_order, split_order);
+ split_page_owner(folio_page(folio, 0), old_order, split_order);
pgalloc_tag_split(folio, old_order, split_order);
__split_folio_to_order(folio, old_order, split_order);
@@ -4394,7 +4394,7 @@ int folio_split_unmapped(struct folio *folio, unsigned int new_order)
VM_WARN_ON_ONCE_FOLIO(!folio_test_large(folio), folio);
VM_WARN_ON_ONCE_FOLIO(!folio_test_anon(folio), folio);
- return __folio_freeze_split_anon(folio, new_order, &folio->page,
+ return __folio_freeze_split_anon(folio, new_order, folio_page(folio, 0),
false, NULL, SPLIT_TYPE_UNIFORM);
}
@@ -4450,7 +4450,7 @@ int __split_huge_page_to_list_to_order(struct page *page, struct list_head *list
{
struct folio *folio = page_folio(page);
- return __folio_split(folio, new_order, &folio->page, page, list,
+ return __folio_split(folio, new_order, folio_page(folio, 0), page, list,
SPLIT_TYPE_UNIFORM);
}
@@ -4481,8 +4481,8 @@ int __split_huge_page_to_list_to_order(struct page *page, struct list_head *list
int folio_split(struct folio *folio, unsigned int new_order,
struct page *split_at, struct list_head *list)
{
- return __folio_split(folio, new_order, split_at, &folio->page, list,
- SPLIT_TYPE_NON_UNIFORM);
+ return __folio_split(folio, new_order, split_at, folio_page(folio, 0),
+ list, SPLIT_TYPE_NON_UNIFORM);
}
/**
@@ -4514,7 +4514,7 @@ unsigned int min_order_for_split(struct folio *folio)
int split_folio_to_list(struct folio *folio, struct list_head *list)
{
- return split_huge_page_to_list_to_order(&folio->page, list, 0);
+ return split_huge_page_to_list_to_order(folio_page(folio, 0), list, 0);
}
/*
--
2.56.0.rc1.315.gc6ed9934b7-goog
next prev parent reply other threads:[~2026-09-29 21:53 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 21:51 [PATCH 00/15] mm: eliminate &folio->page references in mm/ Nilay Vaish
2026-09-29 21:51 ` [PATCH 01/15] mm/khugepaged: drop redundant page parameter from set_huge_pmd() Nilay Vaish
2026-09-29 21:51 ` [PATCH 02/15] mm/huge_memory: use folio_page() in PMD/PUD rmap, zap, and migration Nilay Vaish
2026-09-29 21:51 ` Nilay Vaish [this message]
2026-09-29 21:51 ` [PATCH 04/15] mm/hugetlb_vmemmap: use folio_page() for vmemmap address arithmetic Nilay Vaish
2026-09-29 21:51 ` [PATCH 05/15] mm/hugetlb_cma: use folio_page() in hugetlb_cma_free_frozen_folio() Nilay Vaish
2026-09-29 21:51 ` [PATCH 06/15] mm/hugetlb: replace &folio->page with folio_page() and VM_BUG_ON_FOLIO() Nilay Vaish
2026-09-29 21:51 ` [PATCH 07/15] mm/page_isolation: use folio_page() in page_is_unmovable() Nilay Vaish
2026-09-29 21:51 ` [PATCH 08/15] mm/compaction: stop casting free pages to struct folio Nilay Vaish
2026-09-29 21:52 ` [PATCH 09/15] mm/migrate, vmscan: use folio_page() for movable_ops helpers Nilay Vaish
2026-09-29 21:52 ` [PATCH 10/15] mm/memory: use folio_page() in fault and CoW paths Nilay Vaish
2026-09-29 21:52 ` [PATCH 11/15] mm/rmap, gup: use folio_page() for PageAnonExclusive and gup_must_unshare Nilay Vaish
2026-09-29 21:52 ` [PATCH 12/15] mm/ksm, userfaultfd: replace &folio->page with folio_page() Nilay Vaish
2026-09-29 21:52 ` [PATCH 13/15] mm/page_alloc, folio: use folio_page() when freeing folios Nilay Vaish
2026-09-29 21:52 ` [PATCH 14/15] mm/page_owner, alloc_tag: use folio_page() for page_ext and codetag Nilay Vaish
2026-09-29 21:52 ` [PATCH 15/15] mm: replace remaining &folio->page uses with folio_page() and helpers Nilay Vaish
2026-09-30 10:17 ` [PATCH 00/15] mm: eliminate &folio->page references in mm/ David Hildenbrand (Arm)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260929215206.516490-4-nilayvaish@google.com \
--to=nilayvaish@google.com \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=gthelen@google.com \
--cc=kfree@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.