mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 00/14] mm/ksm: merge-path cleanups and folio conversion
@ 2026-09-15 15:12 Longlong Xia
  2026-09-15 15:12 ` [PATCH 01/14] mm/ksm: constify ksm_next_page_ops Longlong Xia
                   ` (11 more replies)
  0 siblings, 12 replies; 19+ messages in thread
From: Longlong Xia @ 2026-09-15 15:12 UTC (permalink / raw)
  To: Andrew Morton, linux-mm
  Cc: Longlong Xia, David Hildenbrand, Xu Xin, Chengming Zhou, linux-kernel

From: Longlong Xia <xialonglong@kylinos.cn>

Clean up KSM's scan helpers, advisor naming and sysfs formatting, then
pass folios through the merge path and update the related comments.

Patches 11-13 convert the merge targets of the merge path to folios,
continuing the earlier conversion of write_protect_page(),
stable_tree_insert() and the ksm_get_folio() helpers.

Before this series the merge path talked to the stable tree in folios
but to the merge helpers in pages, so the same ksm folio was wrapped
and unwrapped at every level:

  stable_tree_search() returns a folio
        |
        v
      try_to_merge_with_ksm_page(..., &kfolio->page)   <- unwrap
        |
        v
  try_to_merge_one_page(..., kpage)                    <- page all the way
        |
        v
  replace_page(vma, page, kpage, ...)
        |
        v
  kfolio = page_folio(kpage)                           <- re-wrap
  folio  = page_folio(page)                            <- re-wrap

With patches 11-13 every function in the chain takes the ksm folio
directly:

  stable_tree_search() returns a folio
        |
        v
      try_to_merge_with_ksm_folio(..., kfolio)
        |
        v
  try_to_merge_one_page(..., kfolio)
        |
        v
  replace_page(vma, folio, kfolio, ...)
        |
        v
  folio_page(folio, 0) only where a 4K page is needed (pte and rmap)

No functional change intended.

This series is based on next-20260914 (1a1de54f7369).

Longlong Xia (14):
  mm/ksm: constify ksm_next_page_ops
  mm/ksm: rename advisor_ctx to ksm_advisor_ctx
  mm/ksm: use the correct format specifier for max_page_sharing
  mm/ksm: add advance_scan_mm_slot() helper
  mm/ksm: make remove_stable_node_chain() return bool
  mm/ksm: clear all slab cache pointers in ksm_slab_free()
  mm/ksm: reuse the zero page pointer for merge tracing
  mm/ksm: document the two remove_rmap_item_from_tree() calls
  mm/ksm: move the no_vmas label out of the if block
  mm/ksm: extract ksm_begin_full_scan() from scan_get_next_rmap_item()
  mm/ksm: pass folios to replace_page()
  mm/ksm: take the ksm folio in try_to_merge_one_page()
  mm/ksm: take the ksm folio in try_to_merge_with_ksm_page()
  mm/ksm: update merge helper comments for folios

 mm/ksm.c | 270 +++++++++++++++++++++++++++++++------------------------
 1 file changed, 152 insertions(+), 118 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2026-09-16  8:47 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-15 15:12 [PATCH 00/14] mm/ksm: merge-path cleanups and folio conversion Longlong Xia
2026-09-15 15:12 ` [PATCH 01/14] mm/ksm: constify ksm_next_page_ops Longlong Xia
2026-09-15 15:12 ` [PATCH 02/14] mm/ksm: rename advisor_ctx to ksm_advisor_ctx Longlong Xia
2026-09-15 15:12 ` [PATCH 03/14] mm/ksm: use the correct format specifier for max_page_sharing Longlong Xia
2026-09-15 15:12 ` [PATCH 04/14] mm/ksm: add advance_scan_mm_slot() helper Longlong Xia
2026-09-15 15:12 ` [PATCH 05/14] mm/ksm: make remove_stable_node_chain() return bool Longlong Xia
2026-09-15 15:12 ` [PATCH 06/14] mm/ksm: clear all slab cache pointers in ksm_slab_free() Longlong Xia
2026-09-15 15:12 ` [PATCH 07/14] mm/ksm: reuse the zero page pointer for merge tracing Longlong Xia
2026-09-15 15:12 ` [PATCH 08/14] mm/ksm: document the two remove_rmap_item_from_tree() calls Longlong Xia
2026-09-15 15:12 ` [PATCH 09/14] mm/ksm: move the no_vmas label out of the if block Longlong Xia
2026-09-15 15:12 ` [PATCH 10/14] mm/ksm: extract ksm_begin_full_scan() from scan_get_next_rmap_item() Longlong Xia
2026-09-15 15:23 ` [PATCH 11/14] mm/ksm: pass folios to replace_page() Longlong Xia
2026-09-15 15:23   ` [PATCH 12/14] mm/ksm: take the ksm folio in try_to_merge_one_page() Longlong Xia
2026-09-15 15:23   ` [PATCH 13/14] mm/ksm: take the ksm folio in try_to_merge_with_ksm_page() Longlong Xia
2026-09-15 15:23   ` [PATCH 14/14] mm/ksm: update merge helper comments for folios Longlong Xia
2026-09-15 16:48 ` [PATCH 00/14] mm/ksm: merge-path cleanups and folio conversion Matthew Wilcox
2026-09-15 22:25   ` Longlong Xia
2026-09-16  6:37     ` David Hildenbrand (Arm)
2026-09-16  8:46       ` Longlong Xia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®