Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: Suren Baghdasaryan <surenb@google.com>
Cc: chuanhua han <hanchuanhua802@gmail.com>,
	 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>,
	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: Wed, 2 Dec 2026 09:10:08 +0000	[thread overview]
Message-ID: <aw_fpcuaRgHvMhpW@gremlin> (raw)
In-Reply-To: <CAJuCfpFP_Zno2pN9GkUGJFKpjbe1=YRF8Qk5tWLck3uadgKFWA@mail.gmail.com>

On Tue, Dec 01, 2026 at 06:49:55PM -0800, Suren Baghdasaryan wrote:
> On Tue, Dec 1, 2026 at 5:24 PM chuanhua han <hanchuanhua802@gmail.com> wrote:
> > I did use an AI assistant for this series and should have said so, sorry. I'll start with smaller MGLRU patches.

Thank you, I appreciate your candour!

> >
> > The mmap_lock waits behind the MGLRU walk do cause frame drops on our
> > phones, so I'd still like to fix that at some point. If the MGLRU
> > maintainers have a preferred direction, I'm happy to hear it.
>
> I looked ahead at what you are doing later in the patchset and yeah,
> that's definitely not something I'm comfortable with. Lockless VMA
> walks are quite complex, just look at the lock_next_vma()
> implementation. Speaking of which, from a quick look at your
> walk_trylock_next_vma(), I think it might have been much easier to add
> an option for lock_next_vma() to not fall back to mmap_lock, which I
> think would have been enough to fit your usecase. I didn't spend much
> time exploring that direction but it might be a much simpler change.

Yeah I agree making a version of lock_next_vma() that doesn't fallback makes
sense, but I think best way is to model it on the BPF user, i.e. replace the
open-coded work there with a variant that permits it.

Then obviously others who have a use for it can do so.

Maybe try_lock_next_vma(), since lock_next_vma() is trying to guarantee a lock
either way?

>
> Also a side-note about drop_mm part in this patch. In [1] Lorenzo
> recently changed vma_start_read() to use mmdrop_async(), so that
> "mmdrop() is a heavy operation" thing does not apply anymore.

Yup :)

>
> [1] https://lore.kernel.org/all/20261124-vma-read-lock-mmdrop-async-v1-1-257f99f551de@kernel.org/

--
Cheers, Lorenzo


  parent reply	other threads:[~2026-12-02  9:10 UTC|newest]

Thread overview: 11+ 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)
2026-12-02  1:24     ` chuanhua han
2026-12-02  2:49       ` Suren Baghdasaryan
2026-12-02  4:20         ` chuanhua han
2026-12-02  9:10         ` 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=aw_fpcuaRgHvMhpW@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