Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: <xu.xin16@zte.com.cn>
Cc: <david@kernel.org>, <chengming.zhou@linux.dev>,
	<hughd@google.com>, <wang.yaxin@zte.com.cn>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>, <ljs@kernel.org>
Subject: Re: [PATCH v11 0/3] KSM: performance optimizations for rmap_walk_ksm
Date: Sun, 5 Jul 2026 01:00:00 -0700	[thread overview]
Message-ID: <20260705010000.1f9b63735aa19fbfb5d9c24f@linux-foundation.org> (raw)
In-Reply-To: <20260703162253688u8Str9eFLR8TGCmo7nIOF@zte.com.cn>

On Fri, 3 Jul 2026 16:22:53 +0800 (CST) <xu.xin16@zte.com.cn> wrote:

> This series fixes a severe KSM reverse-mapping performance problem
> that can freeze applications for hundreds of milliseconds under
> memory pressure especially when a lot of unrelated VMAs sharing a
> single anon_vma.
> 
> Two key highlights:
> 
> 1. Lock hold time drops from >500ms to <2ms
>    - In our benchmark (20,000 VMAs sharing an anon_vma), worst-case
>      anon_vma lock hold time during KSM rmap walk went from 705ms
>      down to 1.67ms (max) and 1.44ms (avg).
> 
> 2. Real user impact
>    - The anon_vma lock is also acquired by page faults, reclaim,
>      migration, compaction, mlock, exit_mmap, and cgroup accounting.
> 
>    - A long hold due to inefficient rmap walks stalls application
>      threads, causing latency spikes, reduced throughput, or even
>      container timeouts.
> 
>    - The problem occurs even without fork() – VMA splitting (e.g.,
>      via mprotect or madvise over time) can create tens of thousands
>      of VMAs all attached to the same anon_vma.
> 
> Real-world examples:

Again, thanks for persisting with this.  Great improvement and I'd love
to see us get this finished off.

Please have a look through the AI review:

	https://sashiko.dev/#/patchset/20260703162253688u8Str9eFLR8TGCmo7nIOF@zte.com.cn

That 32-bit thing looks legit, kinda fatal but easy to address.


  parent reply	other threads:[~2026-07-05  8:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-03  8:22 [PATCH v11 0/3] KSM: performance optimizations for rmap_walk_ksm xu.xin16
2026-07-03  8:23 ` [PATCH v11 1/3] ksm: add linear_page_index into ksm_rmap_item xu.xin16
2026-07-03  8:25 ` [PATCH v11 2/3] ksm: Optimize rmap_walk_ksm by passing a suitable page index xu.xin16
2026-07-06  6:53   ` David Hildenbrand (Arm)
2026-07-03  8:26 ` [PATCH v11 3/3] ksm: add mremap selftests for ksm_rmap_walk xu.xin16
2026-07-06  6:55   ` David Hildenbrand (Arm)
2026-07-05  8:00 ` Andrew Morton [this message]
2026-07-06  4:40   ` [PATCH v11 0/3] KSM: performance optimizations for rmap_walk_ksm xu.xin16
2026-07-06  6:49     ` 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=20260705010000.1f9b63735aa19fbfb5d9c24f@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=chengming.zhou@linux.dev \
    --cc=david@kernel.org \
    --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