All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mm-unstable v1 0/3] MM: Tighten control over zero-page remapping
@ 2026-06-09 11:46 Nico Pache
  2026-06-09 11:46 ` [PATCH mm-unstable v1 1/3] mm/ksm: export ksm_is_running() to check KSM merge state Nico Pache
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Nico Pache @ 2026-06-09 11:46 UTC (permalink / raw)
  To: linux-kernel, linux-mm, Usama Arif, Yu Zhao
  Cc: aarcange, Nico Pache, Andrew Morton, David Hildenbrand, Xu Xin,
	Chengming Zhou, Lorenzo Stoakes, Zi Yan, Baolin Wang,
	Liam R. Howlett, Ryan Roberts, Dev Jain, Barry Song, Lance Yang,
	Matthew Brost, Joshua Hahn, Rakie Kim, Byungchul Park,
	Gregory Price, Ying Huang, Alistair Popple

This patch series fixes a bug in KSM where the pages_to_scan limit is
bypassed and the policy (use_zero_pages) is ignored. It also gives users
further control of the zero-page remapping that occurs when a folio is
split.

Commit b1f202060afe ("mm: remap unused subpages to shared zeropage when
splitting isolated thp") added unconditional zero-page remapping when a
folio is split. This was sold as part of the underutilized shrinker, but
has a larger effect. Since this commit, all splits do this zero-page
scanning and remapping, even if the user has the underutilized shrinker
disabled.

This unconditional zero-page remapping was also problematic for KSM, as
when KSM would try to merge a page, it would split the folio and the
zero-page remapping would remap all zero-filled pages to the shared
zero-page bypassing the use_zero_pages policy. When the user had this
feature disabled, KSM would then waste cycles scanning these already
freed pages, causing little progress to be made, and KSMs performance to
degrade.

In this series we also gate the zero-page remapping behind
split_underused_thp (the sysfs for the underutilized shrinker). This
provides users with more control over this behavior, while also preventing
the KSM bug when it is enabled.

RFC: https://lore.kernel.org/all/20260508170509.640851-1-npache@redhat.com/

Nico Pache (3):
  mm/ksm: export ksm_is_running() to check KSM merge state
  mm/migrate.c: Prevent folio splitting from interacting with KSM
  mm/huge_memory.c: Skip zero-page remapping when underused THP shrinker
    is disabled

 include/linux/ksm.h | 6 ++++++
 mm/huge_memory.c    | 2 +-
 mm/ksm.c            | 6 ++++++
 mm/migrate.c        | 9 +++++++++
 4 files changed, 22 insertions(+), 1 deletion(-)


base-commit: be18cf77e1e749c6469ff44df00eb026f7c0a365
-- 
2.54.0



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

end of thread, other threads:[~2026-06-09 17:27 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-09 11:46 [PATCH mm-unstable v1 0/3] MM: Tighten control over zero-page remapping Nico Pache
2026-06-09 11:46 ` [PATCH mm-unstable v1 1/3] mm/ksm: export ksm_is_running() to check KSM merge state Nico Pache
2026-06-09 14:13   ` Lorenzo Stoakes
2026-06-09 11:46 ` [PATCH mm-unstable v1 2/3] mm/migrate.c: Prevent folio splitting from interacting with KSM Nico Pache
2026-06-09 12:12   ` xu.xin16
2026-06-09 12:57     ` Nico Pache
2026-06-09 12:59       ` David Hildenbrand (Arm)
2026-06-09 13:47       ` xu.xin16
2026-06-09 14:07         ` Zi Yan
2026-06-09 17:27           ` Usama Arif
2026-06-09 13:06     ` Lance Yang
2026-06-09 13:42       ` Nico Pache
2026-06-09 13:49         ` xu.xin16
2026-06-09 14:14           ` Lorenzo Stoakes
2026-06-09 14:26   ` Lorenzo Stoakes
2026-06-09 11:46 ` [PATCH mm-unstable v1 3/3] mm/huge_memory.c: Skip zero-page remapping when underused THP shrinker is disabled Nico Pache

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.