From: Barry Song <21cnbao@gmail.com>
To: Lokesh Gidra <lokeshgidra@google.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
kaleshsingh@google.com, ngeoffray@google.com,
David Hildenbrand <david@redhat.com>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
Harry Yoo <harry.yoo@oracle.com>, Peter Xu <peterx@redhat.com>,
Suren Baghdasaryan <surenb@google.com>,
SeongJae Park <sj@kernel.org>
Subject: Re: [RFC PATCH 1/2] mm: always call rmap_walk() on locked folios
Date: Tue, 9 Sep 2025 05:47:21 +0800 [thread overview]
Message-ID: <CAGsJ_4zuj1nNpS0Ap=x-_dqERTU_NiCZAiHD=JULY1FQn+NwMw@mail.gmail.com> (raw)
In-Reply-To: <20250908044950.311548-1-lokeshgidra@google.com>
On Mon, Sep 8, 2025 at 12:50 PM Lokesh Gidra <lokeshgidra@google.com> wrote:
>
> Prior discussion about this can be found at [1].
>
> rmap_walk() requires all folios, except non-KSM anon, to be locked. This
> implies that when threads update folio->mapping to an anon_vma with
> different root (currently only done by UFFDIO MOVE), they have to
> serialize against rmap_walk() with write-lock on the anon_vma, hurting
> scalability. Furthermore, this necessitates rechecking anon_vma when
> pinning/locking an anon_vma (like in folio_lock_anon_vma_read()).
>
> This can be simplified quite a bit by ensuring that rmap_walk() is
> always called on locked folios. Among the few callers of rmap_walk() on
> unlocked anon folios, shrink_active_list()->folio_referenced() is the
> only performance critical one.
As I understand it, shrink_inactive_list() also invokes folio_referenced().
Shouldn’t it be called just as often as shrink_active_list()?
>
> shrink_active_list() doesn't act differently depending on what
> folio_referenced() returns for an anon folio. So returning 1 when it
> is contended, like in case of other folio types, wouldn't have any
> negative impact.
A complaint was raised that the LRU could become slightly disordered:
https://lore.kernel.org/linux-mm/20240219141703.3851-1-lipeifeng@oppo.com/
We can re-test to confirm if this is the case.
Thanks
Barry
next prev parent reply other threads:[~2025-09-08 21:47 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-08 4:49 Lokesh Gidra
2025-09-08 4:49 ` [RFC PATCH 2/2] userfaultfd: remove anon-vma lock for moving folios in MOVE ioctl Lokesh Gidra
2025-09-11 20:07 ` Lorenzo Stoakes
2025-09-12 9:15 ` David Hildenbrand
2025-09-08 21:47 ` Barry Song [this message]
2025-09-08 22:12 ` [RFC PATCH 1/2] mm: always call rmap_walk() on locked folios Lokesh Gidra
2025-09-09 0:40 ` Barry Song
2025-09-09 5:37 ` Lokesh Gidra
2025-09-09 5:51 ` Barry Song
2025-09-09 5:56 ` Lokesh Gidra
2025-09-09 6:01 ` Barry Song
2025-09-11 19:05 ` Lokesh Gidra
2025-09-12 5:10 ` Barry Song
2025-09-10 10:10 ` Harry Yoo
2025-09-10 15:33 ` Lokesh Gidra
2025-09-11 8:40 ` Harry Yoo
2025-09-12 3:29 ` Miaohe Lin
2025-09-11 19:39 ` Lorenzo Stoakes
2025-09-12 9:03 ` David Hildenbrand
2025-09-13 4:27 ` Lokesh Gidra
2025-09-15 11:27 ` Lorenzo Stoakes
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='CAGsJ_4zuj1nNpS0Ap=x-_dqERTU_NiCZAiHD=JULY1FQn+NwMw@mail.gmail.com' \
--to=21cnbao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=harry.yoo@oracle.com \
--cc=kaleshsingh@google.com \
--cc=linux-mm@kvack.org \
--cc=lokeshgidra@google.com \
--cc=lorenzo.stoakes@oracle.com \
--cc=ngeoffray@google.com \
--cc=peterx@redhat.com \
--cc=sj@kernel.org \
--cc=surenb@google.com \
/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