mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: xu.xin16@zte.com.cn, akpm@linux-foundation.org
Cc: chengming.zhou@linux.dev, hughd@google.com,
	wang.yaxin@zte.com.cn, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, ljs@kernel.org, corbet@lwn.net
Subject: Re: [PATCH v7 2/6] tools/testing: add rmap walk latency benchmark
Date: Fri, 5 Jun 2026 17:54:11 +0200	[thread overview]
Message-ID: <c3ccd136-8898-49ff-8c0f-3e4b543fafc2@kernel.org> (raw)
In-Reply-To: <20260530170404509QpJmBtpSjn3uQHeVKA2iA@zte.com.cn>

On 5/30/26 11:04, xu.xin16@zte.com.cn wrote:
> From: xu xin <xu.xin16@zte.com.cn>
> 
> Add a benchmark to measure rmap_walk latency for KSM, anonymous,
> and file-backed pages under high sharing.
> 
> For KSM, the sysfs file "max_page_sharing" is set as 256 to make
> sure that every KSM page can be shared by 256 original pages. A
> large region is split into 20000 VMAs via mprotect then merged by
> KSM, whose purpose is to construct a lot of unrelated VMAs
> sharing its anon_vma to reproduce the issue proposed at
> https://lore.kernel.org/all/20260503205013850sym7UO0jvKJzyRiTYmO8V@zte.com.cn/.
> 
> For anon and file pages, 256 (equal to KSM's max_page_sharing)
> child processes are forked to share a single physical page (COW
> not broken). The benchmark uses move_pages() to trigger migration,
> collects rmap_walk_start/end trace events, and reports max/average
> latency. The tool also saves/restores KSM config and filters trace
> events by PID to avoid noise.
> 
> For each test, the program prints the number of captured events and
> the maximum / average latency in milliseconds.
> 
> This benchmark helps developers evaluate optimizations in the reverse
> mapping code, such as limiting max_page_sharing or improving tree
> traversal efficiency.
> 
> Usage (must be run as root):
> '# cd tools/testing/rmap/ && make
> ’# sudo ./rmap_benchmark
> KSM rmap_walk latency (Shared by 256 VMAs via mprotect and KSM merge):
>   Max: 839.00 ms (838998 us)
>   Avg: 605.80 ms (605799 us)
>   Count: 4 events
> Anonymous page rmap_walk latency (Shared by 256 VMAs via fork, COW not broken):
>   Max: 4.05 ms (4055 us)
>   Avg: 2.86 ms (2858 us)
>   Count: 2 events
> File page rmap_walk latency (Shared by 256 VMAs via fork, MAP_SHARED):
>   Max: 2.57 ms (2572 us)
>   Avg: 1.25 ms (1250 us)
>   Count: 4 events
> 
> Signed-off-by: xu xin <xu.xin16@zte.com.cn>
> ---

And that benchmark would then also have to be carried OOT I guess.

-- 
Cheers,

David

  reply	other threads:[~2026-06-05 15:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-30  8:59 [PATCH v7 0/6] KSM: performance optimizations for rmap_walk_ksm xu.xin16
2026-05-30  9:03 ` [PATCH v7 1/6] mm/rmap: add tracepoint for rmap_walk xu.xin16
2026-06-05 15:53   ` David Hildenbrand (Arm)
2026-05-30  9:04 ` [PATCH v7 2/6] tools/testing: add rmap walk latency benchmark xu.xin16
2026-06-05 15:54   ` David Hildenbrand (Arm) [this message]
2026-05-30  9:06 ` [PATCH v7 3/6] MAINTAINERS: add myself as reviewer for rmap section xu.xin16
2026-06-05 16:03   ` David Hildenbrand (Arm)
2026-06-05 16:16     ` Lorenzo Stoakes
2026-05-30  9:07 ` [PATCH v7 4/6] ksm: add pgoff into ksm_rmap_item xu.xin16
2026-06-05 17:19   ` David Hildenbrand (Arm)
2026-06-09  4:51     ` xu.xin16
2026-05-30  9:09 ` [PATCH v7 5/6] ksm: Optimize rmap_walk_ksm by passing a suitable pgoff xu.xin16
2026-05-30  9:10 ` [PATCH v7 6/6] ksm: add mremap selftests for ksm_rmap_walk xu.xin16

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=c3ccd136-8898-49ff-8c0f-3e4b543fafc2@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=chengming.zhou@linux.dev \
    --cc=corbet@lwn.net \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=wang.yaxin@zte.com.cn \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox