Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: Chuanhua Han <hanchuanhua802@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org,  Kairui Song <kasong@tencent.com>,
	Barry Song <baohua@kernel.org>, Qi Zheng <qi.zheng@linux.dev>,
	 Shakeel Butt <shakeel.butt@linux.dev>,
	Axel Rasmussen <axelrasmussen@google.com>,
	 Yuanchu Xie <yuanchu@google.com>, Wei Xu <weixugc@google.com>,
	Baoquan He <baoquan.he@linux.dev>,
	 Baolin Wang <baolin.wang@linux.alibaba.com>,
	David Hildenbrand <david@kernel.org>,
	 "Liam R. Howlett" <liam@infradead.org>,
	Vlastimil Babka <vbabka@kernel.org>,
	 Mike Rapoport <rppt@kernel.org>, Michal Hocko <mhocko@suse.com>,
	 Suren Baghdasaryan <surenb@google.com>,
	Pedro Falcato <pfalcato@suse.de>, Jann Horn <jannh@google.com>,
	 Johannes Weiner <hannes@cmpxchg.org>,
	Jonathan Corbet <corbet@lwn.net>,
	 Shuah Khan <skhan@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	linux-doc@vger.kernel.org,  Michal Hocko <mhocko@kernel.org>,
	Matthew Wilcox <willy@infradead.org>,
	 Yu Zhao <yuzhao@google.com>,
	Kalesh Singh <kaleshsingh@google.com>,
	 Hugh Dickins <hughd@google.com>,
	Ridong Chen <ridong.chen@linux.dev>,
	 linux-kernel@vger.kernel.org,
	Chuanhua Han <hanchuanhua@xiaomi.com>
Subject: Re: [RFC PATCH 1/5] mm/mmap_lock: add vma_start_read_rcu() helper
Date: Tue, 1 Dec 2026 13:24:34 +0000	[thread overview]
Message-ID: <aw7IZ8i6pz9yHEYH@gremlin> (raw)
In-Reply-To: <20261201131135.2914944-2-hanchuanhua@xiaomi.com>

NAK. You're not doing this. Any of it, sorry.

On Tue, Dec 01, 2026 at 09:11:31PM +0800, Chuanhua Han wrote:
> A later patch makes the MGLRU aging walk lock VMAs one at a time instead
> of holding mmap_lock for the whole mm. The walk only tries to read-lock
> each VMA it finds under RCU, and skips the VMA if its lock is held for
> write, rather than waiting for the writer. It does so in two places:

No.

>
>  - While iterating the VMA tree under RCU.
>
>  - While holding a PTE lock, inside the RCU read side critical section
>    of pte_offset_map(), to hand the VMA lock off to the next VMA in
>    the same PTE table without dropping the PTE lock. Waiting there
>    could deadlock: a writer such as mprotect() takes the PTE lock
>    after the VMA write lock.
>

No.

> vma_start_read() does not fit the second place, and is awkward in the
> first. When it fails, it leaves the RCU read side critical section,
> which the PTE table mapped by pte_offset_map() depends on, and the
> iteration has to look the next VMA up again. If the VMA has been
> recycled for another mm, it also mmdrop()s that mm, and __mmdrop() is
> heavy enough that vma_start_read() already defers it until after RCU;
> it should not run under a PTE lock either. lock_vma_under_rcu() and
> lock_next_vma() build on vma_start_read() and, on failure, retry or
> fall back to mmap_lock. The walk cannot open code the locking, which
> relies on helpers private to mm/mmap_lock.c.

NO.

>
> Move the body of vma_start_read() into __vma_start_read(), which stays
> in the RCU read side critical section and returns the other mm through
> @drop_mm instead of dropping it, and rebuild vma_start_read() on top
> of it with the same behavior.

No.

>
> Add vma_start_read_rcu() on top of __vma_start_read(). It returns NULL
> both when the VMA cannot be locked and when it is detached, since the
> walk skips it either way. The caller mmdrop()s the mm returned in
> @drop_mm after dropping its spinlocks and leaving RCU, and, as with
> any VMA found under RCU, checks that the locked VMA still covers the
> range it expects.

No.

>
> No functional change.

Not true, you're creating a brand new API and expecting VMA maintainers to
maintain it indefinitely.

Also to give you free review time.

>
> Signed-off-by: Chuanhua Han <hanchuanhua@xiaomi.com>

No thanks.

As VMA co-maintainer let me just make this simple - I am not interested in
changes like this from unknown people, at all. Sorry.

LLMs have changed the landscape. Do smaller changes first. I have no
confidence you understand any of it.

--
Cheers, Lorenzo


  reply	other threads:[~2026-12-01 13:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 13:11 [RFC PATCH 0/5] mm/mglru: walk page tables under per-VMA locks Chuanhua Han
2026-12-01 13:11 ` [RFC PATCH 1/5] mm/mmap_lock: add vma_start_read_rcu() helper Chuanhua Han
2026-12-01 13:24   ` Lorenzo Stoakes (ARM) [this message]
2026-12-01 13:11 ` [RFC PATCH 2/5] mm/mglru: split the VMA flag checks out of should_skip_vma() Chuanhua Han
2026-12-01 13:11 ` [RFC PATCH 3/5] mm/mglru: walk page tables under per-VMA locks Chuanhua Han
2026-12-01 13:11 ` [RFC PATCH 4/5] mm/mglru: hand off VMA locks without dropping the PTE lock Chuanhua Han
2026-12-01 13:11 ` [RFC PATCH 5/5] mm/mglru: update the docs for the per-VMA lock walk Chuanhua Han

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=aw7IZ8i6pz9yHEYH@gremlin \
    --to=ljs@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=axelrasmussen@google.com \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=baoquan.he@linux.dev \
    --cc=corbet@lwn.net \
    --cc=david@kernel.org \
    --cc=hanchuanhua802@gmail.com \
    --cc=hanchuanhua@xiaomi.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=jannh@google.com \
    --cc=kaleshsingh@google.com \
    --cc=kasong@tencent.com \
    --cc=liam@infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=mhocko@suse.com \
    --cc=pfalcato@suse.de \
    --cc=qi.zheng@linux.dev \
    --cc=rdunlap@infradead.org \
    --cc=ridong.chen@linux.dev \
    --cc=rppt@kernel.org \
    --cc=shakeel.butt@linux.dev \
    --cc=skhan@linuxfoundation.org \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --cc=weixugc@google.com \
    --cc=willy@infradead.org \
    --cc=yuanchu@google.com \
    --cc=yuzhao@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