linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] mm/ksm: Fix incorrect accounting of KSM counters during fork.
@ 2025-09-23 18:46 Donet Tom
  2025-09-23 18:46 ` [PATCH v3 1/2] mm/ksm: Fix incorrect KSM counter handling in mm_struct " Donet Tom
  2025-09-23 18:47 ` [PATCH v3 2/2] selftests/mm: Added fork inheritance test for ksm_merging_pages counter Donet Tom
  0 siblings, 2 replies; 3+ messages in thread
From: Donet Tom @ 2025-09-23 18:46 UTC (permalink / raw)
  To: Andrew Morton, David Hildenbrand
  Cc: Ritesh Harjani, Xu Xin, Chengming Zhou, Wei Yang,
	Aboorva Devarajan, linux-mm, linux-kernel, Giorgi Tchankvetadze,
	Donet Tom

The first patch in this series fixes the incorrect accounting of KSM
counters such as ksm_merging_pages, ksm_rmap_items, and the global
ksm_zero_pages during fork.

The following patch added a selftest to verify the ksm_merging_pages
counter was updated correctly during fork.

Test Results
============
Without the first patch
-----------------------
 # [RUN] test_fork_ksm_merging_page_count
 not ok 10 ksm_merging_page in child: 32

With the first patch
--------------------
 # [RUN] test_fork_ksm_merging_page_count
 ok 10 ksm_merging_pages is not inherited after fork

Changes:
V2 -> v3:
- Added Reviewed-by and Acked-by tags
- Added cleanup on exit in ksm_merging_pages test.
- Dropped test_fork_global_ksm_zero_pages_count because it can give false
  failures if multiple processes attempt KSM zero-page merging and unmerging
  during test execution.

v2: https://lore.kernel.org/all/cover.1757946863.git.donettom@linux.ibm.com/#t

v1: https://lore.kernel.org/all/2e662107e01417bf9af23bc7f52863cd538419be.1756211338.git.donettom@linux.ibm.com/

Donet Tom (2):
  mm/ksm: Fix incorrect KSM counter handling in mm_struct during fork
  selftests/mm: Added fork inheritance test for ksm_merging_pages
    counter

 include/linux/ksm.h                           |  8 +++-
 .../selftests/mm/ksm_functional_tests.c       | 43 ++++++++++++++++++-
 2 files changed, 49 insertions(+), 2 deletions(-)

-- 
2.51.0



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

end of thread, other threads:[~2025-09-23 18:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-23 18:46 [PATCH v3 0/2] mm/ksm: Fix incorrect accounting of KSM counters during fork Donet Tom
2025-09-23 18:46 ` [PATCH v3 1/2] mm/ksm: Fix incorrect KSM counter handling in mm_struct " Donet Tom
2025-09-23 18:47 ` [PATCH v3 2/2] selftests/mm: Added fork inheritance test for ksm_merging_pages counter Donet Tom

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