Skip to content

mm/sparse: remove SECTION_MARKED_PRESENT and further cleanups

David Hildenbrand (Arm) driver-core kexec linux-cxl linux-fsdevel linux-mm lkml 2 versions – In review

Get series with b4
b4 am [email protected] change-id 20260814-b4-sparsemem_cleanups-8bc4b47014c3

Versions newest first

  1. v2 Latest13 patches 11 repliesIn review 12 of 13 applied
  2. v112 patches 46 repliesSuperseded

Changes in v2 from the cover letter

- Rebased to mm-unstable
- Add "scripts/gdb: mm.py: remove fallbacks for SECTION_HAS_MEM_MAP and SECTION_IS_EARLY"
- Improve comment in mmzone.h for __highest_used_section_nr
- Improve comment in fs/proc/page.c for get_max_dump_pfn()
- Move __highest_used_section_nr handling directly into
__section_mark_present() callers and use max()
- Make pfn const in sparse_metadata_init_nid()
- Take care of .clang_format
- Smaller patch description fixes
- Link to v1: https://patch.msgid.link/[email protected]

Patches in v2 12 of 13 applied

#Subject and filesSizeRepliesApplied
1/13mm/sparse: move mem_section init to sparse_extreme_init()include/linux/cache.h mm/sparse.c+13 -71 replyApplied
2/13mm/sparse: refactor sparse_sections_init()mm/sparse.c+17 -240 repliesApplied
3/13mm/sparse: move initialization of section metadata to sparse_metadata_init()mm/sparse.c+22 -210 repliesApplied
4/13mm/sparse: rename and cleanup sparse_init_nid()mm/sparse.c+20 -210 repliesApplied
5/13mm/sparse: cleanup sparse_init_one_section()mm/sparse.h+2 -20 repliesApplied
6/13mm/sparse: rename __highest_present_section_nr to __highest_used_section_nrinclude/linux/mmzone.h mm/compaction.c mm/sparse.c +1 more+10 -140 repliesApplied
7/13mm/sparse: remove pfn_in_present_section()include/linux/mmzone.h+0 -100 repliesApplied
8/13mm/sparse: move __highest_used_section_nr handlingmm/sparse-vmemmap.c mm/sparse.c mm/sparse.h+5 -52 repliesApplied
9/13scripts/gdb: mm.py: remove fallbacks for SECTION_HAS_MEM_MAP and SECTION_IS_EARLYscripts/gdb/linux/mm.py+2 -61 reply
10/13mm/sparse: remove SECTION_MARKED_PRESENT.clang-format drivers/base/memory.c include/linux/mmzone.h +3 more+20 -355 repliesApplied
11/13mm/sparse: remove flags parameter from sparse_init_one_section()mm/sparse-vmemmap.c mm/sparse.c mm/sparse.h+4 -50 repliesApplied
12/13fs/proc/page: clarify comment in get_max_dump_pfn()fs/proc/page.c+3 -40 repliesApplied
13/13mm/memory_hotplug: drop CONFIG_HAVE_ARCH_PFN_VALID handling from pfn_to_online_page()mm/memory_hotplug.c+2 -71 replyApplied

Reviews trailers per patch

12 of 13 patches have a Reviewed-by or Acked-by.

PatchOscar SalvadorLorenzo Stoakes (ARM)Mike Rapoport (Microsoft)Zi Yan
1/13A-b R-b R-b R-b
2/13A-b A-b R-b
3/13A-b R-b R-b
4/13A-b R-b R-b
5/13A-b R-b R-b
6/13A-b R-b R-b
7/13A-b R-b R-b
8/13A-b R-b
9/13
10/13A-b A-b R-b
11/13A-b R-b R-b
12/13A-b A-b R-b
13/13A-b R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v2 thread

Cover letter [PATCH v2 00/13] mm/sparse: remove SECTION_MARKED_PRESENT and further cleanups

SECTION_MARKED_PRESENT is really only needed during boot, where we can instead just rely on SECTION_IS_EARLY_BIT by setting that flag earlier.

Some preparations for doing that conversion and some cleanups in the same (sparse) area.

Tested on x86 with and without memory hotplug through virtio-mem.

---
Changes in v2:
- Rebased to mm-unstable
- Add "scripts/gdb: mm.py: remove fallbacks for SECTION_HAS_MEM_MAP and SECTION_IS_EARLY"
- Improve comment in mmzone.h for __highest_used_section_nr
- Improve comment in fs/proc/page.c for get_max_dump_pfn()
- Move __highest_used_section_nr handling directly into
__section_mark_present() callers and use max()
- Make pfn const in sparse_metadata_init_nid()
- Take care of .clang_format
- Smaller patch description fixes
- Link to v1: https://patch.msgid.link/[email protected]

To: Andrew Morton <[email protected]>
To: David Hildenbrand <[email protected]>
To: Lorenzo Stoakes <[email protected]>
To: "Liam R. Howlett" <[email protected]>
To: Vlastimil Babka <[email protected]>
To: Mike Rapoport <[email protected]>
To: Suren Baghdasaryan <[email protected]>
To: Michal Hocko <[email protected]>
To: Kairui Song <[email protected]>
To: Qi Zheng <[email protected]>
To: Shakeel Butt <[email protected]>
To: Barry Song <[email protected]>
To: Axel Rasmussen <[email protected]>
To: Yuanchu Xie <[email protected]>
To: Wei Xu <[email protected]>
To: Baoquan He <[email protected]>
To: Baolin Wang <[email protected]>
To: Brendan Jackman <[email protected]>
To: Johannes Weiner <[email protected]>
To: Zi Yan <[email protected]>
To: Jan Kiszka <[email protected]>
To: Kieran Bingham <[email protected]>
To: Oscar Salvador <[email protected]>
To: Greg Kroah-Hartman <[email protected]>
To: "Rafael J. Wysocki" <[email protected]>
To: Danilo Krummrich <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---

David Hildenbrand (Arm) (13):
mm/sparse: move mem_section init to sparse_extreme_init()
mm/sparse: refactor sparse_sections_init()
mm/sparse: move initialization of section metadata to sparse_metadata_init() mm/sparse: rename and cleanup sparse_init_nid()
mm/sparse: cleanup sparse_init_one_section()
mm/sparse: rename __highest_present_section_nr to __highest_used_section_nr mm/sparse: remove pfn_in_present_section()
mm/sparse: move __highest_used_section_nr handling
scripts/gdb: mm.py: remove fallbacks for SECTION_HAS_MEM_MAP and SECTION_IS_EARLY mm/sparse: remove SECTION_MARKED_PRESENT
mm/sparse: remove flags parameter from sparse_init_one_section() fs/proc/page: clarify comment in get_max_dump_pfn()
mm/memory_hotplug: drop CONFIG_HAVE_ARCH_PFN_VALID handling from pfn_to_online_page()

 .clang-format           |   2 +-
 drivers/base/memory.c   |   2 +-
 fs/proc/page.c          |   7 +--
 include/linux/cache.h   |   1 +
 include/linux/mmzone.h  |  43 ++++---------
 mm/compaction.c         |   2 +-
 mm/memory_hotplug.c     |   9 +--
 mm/sparse-vmemmap.c     |   4 +-
 mm/sparse.c             | 160 +++++++++++++++++++++++-------------------------
 mm/sparse.h             |  19 ++----
 scripts/gdb/linux/mm.py |   8 +--
 11 files changed, 108 insertions(+), 149 deletions(-)

---

base-commit: 8d61431ed2607386b427752505379536eb634ce8

change-id: 20260814-b4-sparsemem_cleanups-8bc4b47014c3

--

Cheers,

David