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 00/15] mm: eliminate &folio->page references in mm/
Date: Tue, 29 Sep 2026 14:51:51 -0700 [thread overview]
Message-ID: <20260929215206.516490-1-nilayvaish@google.com> (raw)
As part of the memdescs effort to separate struct folio from struct page
and allocate struct folio dynamically [1], struct folio will no longer
embed a struct page member (folio->page), and the address of a struct
folio will no longer equal the address of its head struct page in
vmemmap.
This series eliminates all but one of the remaining &folio->page
references across mm/*.c (25 files) by converting them to:
- folio_page(folio, 0) (or folio_page(folio, i) where indexing a
subpage) when passing a folio's head/subpage struct page * to
page-based helpers (PageAnonExclusive, SetPageAnonExclusive,
rmap/split helpers, movable_ops helpers, HugeTLB Vmemmap Optimization
(HVO) address calculations, page_ext, alloc_tag, etc.);
- VM_BUG_ON_FOLIO(..., old_folio) in place of
VM_BUG_ON_PAGE(..., &old_folio->page) in hugetlb_wp(), and
folio_set_hwpoison(folio) in place of SetPageHWPoison(&folio->page) in
mf_generic_kill_procs();
- ERR_CAST(folio) in place of returning &folio->page on IS_ERR(folio)
paths in do_read_cache_page() and shmem_read_mapping_page_gfp();
- Operating on struct page * directly in compaction_alloc_noprof()
before calling page_rmappable_folio(), and adding &page->lru to
cc->freepages[order] in compaction_free().
The remaining folio->page uses in mm/debug.c (__dump_folio(), which has
three lines: page_has_type(&folio->page) and two reads of
folio->page.page_type) are intentionally left untouched because
__dump_folio() operates on a stack snapshot (&ps.folio_snapshot) rather
than a live struct folio. Those are the only folio->page uses left in
mm/*.c after this series.
This series is based on the mm-unstable branch of Andrew Morton's mm
tree. It has been build- and boot-tested on x86_64 under KVM with
CONFIG_TRANSPARENT_HUGEPAGE, CONFIG_HUGETLBFS,
CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP, CONFIG_CMA, CONFIG_KSM,
CONFIG_USERFAULTFD, CONFIG_MEMORY_FAILURE, CONFIG_PAGE_OWNER,
CONFIG_MEM_ALLOC_PROFILING, and CONFIG_DEBUG_VM enabled.
No functional change is intended while struct folio overlays struct
page.
[1] https://kernelnewbies.org/MatthewWilcox/Memdescs
Nilay Vaish (15):
mm/khugepaged: drop redundant page parameter from set_huge_pmd()
mm/huge_memory: use folio_page() in PMD/PUD rmap, zap, and migration
mm/huge_memory: use folio_page() in THP split paths
mm/hugetlb_vmemmap: use folio_page() for vmemmap address arithmetic
mm/hugetlb_cma: use folio_page() in hugetlb_cma_free_frozen_folio()
mm/hugetlb: replace &folio->page with folio_page() and
VM_BUG_ON_FOLIO()
mm/page_isolation: use folio_page() in page_is_unmovable()
mm/compaction: stop casting free pages to struct folio
mm/migrate, vmscan: use folio_page() for movable_ops helpers
mm/memory: use folio_page() in fault and CoW paths
mm/rmap, gup: use folio_page() for PageAnonExclusive and
gup_must_unshare
mm/ksm, userfaultfd: replace &folio->page with folio_page()
mm/page_alloc, folio: use folio_page() when freeing folios
mm/page_owner, alloc_tag: use folio_page() for page_ext and codetag
mm: replace remaining &folio->page uses with folio_page() and helpers
mm/alloc_tag.c | 10 +++++-----
mm/compaction.c | 15 ++++++---------
mm/filemap.c | 6 +++---
mm/folio.c | 2 +-
mm/gup.c | 11 +++++++----
mm/gup_test.c | 6 ++++--
mm/huge_memory.c | 37 ++++++++++++++++++++-----------------
mm/hugetlb.c | 21 +++++++++++----------
mm/hugetlb_cma.c | 3 ++-
mm/hugetlb_vmemmap.c | 10 +++++-----
mm/hwpoison-inject.c | 2 +-
mm/khugepaged.c | 6 +++---
mm/ksm.c | 16 ++++++++++------
mm/memory-failure.c | 8 ++++----
mm/memory.c | 16 +++++++++-------
mm/memory_hotplug.c | 2 +-
mm/memremap.c | 2 +-
mm/migrate.c | 20 +++++++++++---------
mm/page_alloc.c | 18 ++++++++++--------
mm/page_isolation.c | 2 +-
mm/page_owner.c | 15 +++++++++------
mm/rmap.c | 10 +++++-----
mm/shmem.c | 2 +-
mm/userfaultfd.c | 14 ++++++++------
mm/vmscan.c | 2 +-
25 files changed, 139 insertions(+), 117 deletions(-)
base-commit: 90ddfbd1963659ca4a5d3d7f20717a4222682a8e
--
2.56.0.rc1.315.gc6ed9934b7-goog
next 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 Nilay Vaish [this message]
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 ` [PATCH 03/15] mm/huge_memory: use folio_page() in THP split paths Nilay Vaish
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-1-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.