From: Qiliang Yuan <odys.yuan@gmail.com>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Xu Xin <xu.xin@linux.dev>,
Chengming Zhou <chengming.zhou@linux.dev>,
Stefan Roesch <shr@devkernel.io>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>, Shuah Khan <shuah@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Randy Dunlap <rdunlap@infradead.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH v3 1/4] mm/ksm: align smart scan skips with the scan number
Date: Sat, 7 Nov 2026 21:40:19 -0500 [thread overview]
Message-ID: <20261108024019.1195186-1-odys.yuan@gmail.com> (raw)
In-Reply-To: <7df793d7-55dd-40db-8455-1f22bb44193c@kernel.org>
On 11/7/26 20:51, David Hildenbrand (Arm) wrote:
> On 11/7/26 17:57, Qiliang Yuan wrote:
>> before after after/before
>> pairs merged (of 420) 361 420 116%
>> 334 420 126%
>> pages looked at per scan 1792 2048 114%
>>
>
> Oh, I was wondering whether this should actually go to stable? Do you think the
> above is rather an extreme case, and most users won't really run into it that
> severely?
I don't think it is an extreme case, and the test above rather
understates it: it makes the second page of a pair mergeable while the
first one is still young. The age of an rmap_item only grows, and is not
reset when the page content changes, so on a long running system most
unmerged pages are past age 8 and each is looked at every ninth scan, on
a phase of its own.
To check that case, I let 1800 pairs of unique pages age for 32 scans,
with the second page of each pair made mergeable 1 to 9 scans after the
first, and then gave both pages of each pair the same new content:
kernel pairs merged after 16 / 32 / 256 scans
before the fix 112 / 200 / 200
with the fix 1666 / 1800 / 1800
Before the fix only the pairs whose phases match, one in nine, get
merged, and the others stay unmerged. Three more runs of 64 scans and
one with 128 scans of aging gave 200 and 1800 each time.
It is limited to content that is not in the stable tree yet, since KSM
pages are never skipped and later copies merge with them, and the cost
is memory that stays unmerged. With smart scan on by default since v6.7
and the fix being small, I'd lean towards stable.
I'll send a v4 in the next day or two, which also makes the new selftest
helpers treat a short read or write of smart_scan as an error, and can
add Cc: stable to patch 1 there if you agree.
--
Thanks,
Qiliang
next prev parent reply other threads:[~2026-11-08 2:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 16:56 [PATCH v3 0/4] mm/ksm: keep smart scan from losing duplicate pages Qiliang Yuan
2026-11-07 16:57 ` [PATCH v3 1/4] mm/ksm: align smart scan skips with the scan number Qiliang Yuan
2026-11-07 19:49 ` David Hildenbrand (Arm)
2026-11-07 19:51 ` David Hildenbrand (Arm)
2026-11-08 2:40 ` Qiliang Yuan [this message]
2026-11-07 16:57 ` [PATCH v3 2/4] docs/mm: ksm: describe how smart scan picks the scans to skip Qiliang Yuan
2026-11-07 19:48 ` David Hildenbrand (Arm)
2026-11-07 16:57 ` [PATCH v3 3/4] selftests/mm: move waiting for KSM full scans into a helper Qiliang Yuan
2026-11-07 19:48 ` David Hildenbrand (Arm)
2026-11-07 16:57 ` [PATCH v3 4/4] selftests/mm: cover merging KSM pages aged by smart scan Qiliang Yuan
2026-11-07 19:53 ` David Hildenbrand (Arm)
2026-11-07 19:55 ` [PATCH v3 0/4] mm/ksm: keep smart scan from losing duplicate pages David Hildenbrand (Arm)
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=20261108024019.1195186-1-odys.yuan@gmail.com \
--to=odys.yuan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=chengming.zhou@linux.dev \
--cc=corbet@lwn.net \
--cc=david@kernel.org \
--cc=liam@infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=rdunlap@infradead.org \
--cc=rppt@kernel.org \
--cc=shr@devkernel.io \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=xu.xin@linux.dev \
/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 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®