From: Donet Tom <donettom@linux.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@redhat.com>
Cc: Ritesh Harjani <ritesh.list@gmail.com>,
Xu Xin <xu.xin16@zte.com.cn>,
Chengming Zhou <chengming.zhou@linux.dev>,
Wei Yang <richard.weiyang@gmail.com>,
Aboorva Devarajan <aboorvad@linux.ibm.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Giorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com>,
Donet Tom <donettom@linux.ibm.com>
Subject: [PATCH v2 0/3] mm/ksm: Fix incorrect accounting of KSM counters during fork.
Date: Mon, 15 Sep 2025 20:33:03 +0530 [thread overview]
Message-ID: <cover.1757946863.git.donettom@linux.ibm.com> (raw)
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 two patches add selftests to verify that the
ksm_merging_pages counter and the global ksm_zero_pages counter are
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
# [RUN] test_fork_global_ksm_zero_pages_count
not ok 11 Incorrect global ksm zero page counter after fork
With the first patch
--------------------
# [RUN] test_fork_ksm_merging_page_count
ok 10 ksm_merging_pages is not inherited after fork
# [RUN] test_fork_global_ksm_zero_pages_count
ok 11 Global ksm zero page count is correct after fork
Changes:
v1 -> v2 :
- Rebased to mm-new branch
- Fixed incorrect global ksm_zero_pages counter issue during fork and
added a selftest to verify it.
v1: https://lore.kernel.org/all/2e662107e01417bf9af23bc7f52863cd538419be.1756211338.git.donettom@linux.ibm.com/
Donet Tom (3):
mm/ksm: Fix incorrect KSM counter handling in mm_struct during fork
selftests/mm: Added fork inheritance test for ksm_merging_pages
counter
selftests/mm: Added fork test to verify global ksm_zero_pages counter
behavior
include/linux/ksm.h | 8 +-
.../selftests/mm/ksm_functional_tests.c | 114 +++++++++++++++++-
2 files changed, 120 insertions(+), 2 deletions(-)
--
2.51.0
next reply other threads:[~2025-09-15 15:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-15 15:03 Donet Tom [this message]
2025-09-15 15:03 ` [PATCH v2 1/3] mm/ksm: Fix incorrect KSM counter handling in mm_struct during fork Donet Tom
2025-09-15 23:42 ` Andrew Morton
2025-09-16 2:14 ` Joe Perches
2025-09-16 2:54 ` Andrew Morton
2025-09-16 4:33 ` Sasha Levin
2025-09-16 4:41 ` Andrew Morton
2025-09-16 12:45 ` Sasha Levin
2025-09-16 5:50 ` Donet Tom
2025-09-17 10:38 ` David Hildenbrand
2025-09-17 12:27 ` Chengming Zhou
2025-09-15 15:03 ` [PATCH v2 2/3] selftests/mm: Added fork inheritance test for ksm_merging_pages counter Donet Tom
2025-09-17 13:15 ` David Hildenbrand
2025-09-17 14:45 ` Donet Tom
2025-09-15 15:03 ` [PATCH v2 3/3] selftests/mm: Added fork test to verify global ksm_zero_pages counter behavior Donet Tom
2025-09-17 13:19 ` David Hildenbrand
2025-09-17 14:47 ` Donet Tom
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1757946863.git.donettom@linux.ibm.com \
--to=donettom@linux.ibm.com \
--cc=aboorvad@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=chengming.zhou@linux.dev \
--cc=david@redhat.com \
--cc=giorgitchankvetadze1997@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=richard.weiyang@gmail.com \
--cc=ritesh.list@gmail.com \
--cc=xu.xin16@zte.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.