mm: eliminate &folio->page references in mm/
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest15 patches 1 replyIn review
Patches in v1 No applies recorded yet
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 00/15] mm: eliminate &folio->page references in mm/
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
Signature · 1 line
2.56.0.rc1.315.gc6ed9934b7-goog