Skip to content

mm/ksm: Fix incorrect accounting of KSM counters during fork.

Donet Tom linux-mm lkml stable 2 versions – Applied

Status from this message: [merged mm-stable] selftests-mm-added-fork-inheritance-test-for-ksm_merging_pages-counter.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 0 repliesApplied 2/2
  2. v23 patches 13 repliesSuperseded

Changes in v3 from the cover letter

- 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.

Patches in v3 All 2 applied

#Subject and filesSizeRepliesApplied
1/2mm/ksm: Fix incorrect KSM counter handling in mm_struct during forkinclude/linux/ksm.h+7 -10 repliesApplied
2/2selftests/mm: Added fork inheritance test for ksm_merging_pages countertools/testing/selftests/mm/ksm_functional_tests.c+42 -10 repliesApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchChengming ZhouDavid Hildenbrand
1/2R-b A-b
2/2A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/2] mm/ksm: Fix incorrect accounting of KSM counters during fork.

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/[email protected]/#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(-)
Signature · 1 line
2.51.0