mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] mm/ksm: keep smart scan from losing duplicate pages
@ 2026-11-05  9:36 Qiliang Yuan
  2026-11-05  9:36 ` [PATCH v2 1/2] mm/ksm: align smart scan skips with the scan number Qiliang Yuan
  2026-11-05  9:36 ` [PATCH v2 2/2] selftests/mm: cover merging KSM pages aged by smart scan Qiliang Yuan
  0 siblings, 2 replies; 5+ messages in thread
From: Qiliang Yuan @ 2026-11-05  9:36 UTC (permalink / raw)
  To: Andrew Morton, David Hildenbrand, Xu Xin, Chengming Zhou,
	Stefan Roesch, Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka,
	Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Shuah Khan
  Cc: linux-mm, linux-kernel, linux-kselftest, Qiliang Yuan

With smart scan, which is on by default, two identical pages that become
mergeable some scans apart can stay unmerged for as long as they live:
each page times its skipped scans on its own, and once both are old they
may never be looked at in the same scan, which merging through the
unstable tree requires. This was first noticed as intermittent failures
of ksm_tests "KSM NUMA merging" in run_vmtests.sh.

Patch 1 picks the skipped scans by the global scan number, so all old
pages are looked at together every eighth scan. Over 420 pairs made
mergeable 0 to 20 scans apart, 329 and 317 merged before on two boots
and all of them after, at the cost of 10-12% more ksmd time on memory
that never merges.

Patch 2 adds a ksm_functional_tests case that fails 20/20 without patch
1 and 0/20 with it, on both boots.

Signed-off-by: Qiliang Yuan <odys.yuan@gmail.com>
---
V1 -> V2:
- Rebase onto v7.4-rc1-132-g05441d697f7f and retest there
- Drop the ksm_tests -N -m 1 numbers, as it no longer fails on this base
  without the fix
- Update the ksmd cost to 10-12%, measured on this base

v1: https://lore.kernel.org/r/20261016-bug-mm-ksm-smart-scan-align-skips-v1-0-2f91d76416be@gmail.com

---
Qiliang Yuan (2):
      mm/ksm: align smart scan skips with the scan number
      selftests/mm: cover merging KSM pages aged by smart scan

 mm/ksm.c                                          |  24 ++---
 tools/testing/selftests/mm/ksm_functional_tests.c | 108 +++++++++++++++++++++-
 2 files changed, 117 insertions(+), 15 deletions(-)
---
base-commit: 05441d697f7f9a927264f4058cbbc6a03dfcac9d
change-id: 20261016-bug-mm-ksm-smart-scan-align-skips-cd01e5a9889a

Best regards,
-- 
Qiliang Yuan <odys.yuan@gmail.com>


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

end of thread, other threads:[~2026-11-05 10:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05  9:36 [PATCH v2 0/2] mm/ksm: keep smart scan from losing duplicate pages Qiliang Yuan
2026-11-05  9:36 ` [PATCH v2 1/2] mm/ksm: align smart scan skips with the scan number Qiliang Yuan
2026-11-05 10:03   ` David Hildenbrand (Arm)
2026-11-05  9:36 ` [PATCH v2 2/2] selftests/mm: cover merging KSM pages aged by smart scan Qiliang Yuan
2026-11-05 10:03   ` David Hildenbrand (Arm)

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®