linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Barry Song <21cnbao@gmail.com>
Cc: lokeshgidra@google.com, Liam.Howlett@oracle.com,
	aarcange@redhat.com, akpm@linux-foundation.org,
	axelrasmussen@google.com, bgeffon@google.com, david@redhat.com,
	jannh@google.com, kaleshsingh@google.com,
	kernel-team@android.com, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	ngeoffray@google.com, peterx@redhat.com, rppt@kernel.org,
	ryan.roberts@arm.com, selinux@vger.kernel.org, surenb@google.com,
	timmurray@google.com
Subject: Re: [PATCH v7 4/4] userfaultfd: use per-vma locks in userfaultfd operations
Date: Thu, 23 Jan 2025 17:14:39 +0000	[thread overview]
Message-ID: <Z5J4__VslSFk3A78@casper.infradead.org> (raw)
In-Reply-To: <20250123041427.1987-1-21cnbao@gmail.com>

On Thu, Jan 23, 2025 at 05:14:27PM +1300, Barry Song wrote:
> However, we’ve noticed that userfaultfd still remains one of the largest users
> of mmap_lock for write operations, with the other—binder—having been recently
> addressed by Carlos Llamas's "binder: faster page installations" series:
> 
> https://lore.kernel.org/lkml/20241203215452.2820071-1-cmllamas@google.com/
> 
> The HeapTaskDaemon(Java GC) might frequently perform userfaultfd_register()
> and userfaultfd_unregister() operations, both of which require the mmap_lock
> in write mode to either split or merge VMAs. Since HeapTaskDaemon is a

I don't think that's an innate necessity.  It does require quite some
work in order to fix it though.  Since it was so much work, nobody's
been motivated to fix it ... but now you are!  Congratulations ;-)

The reason we need the mmap_lock in write mode is that the VMA tree is
currently protected by that mmap_lock.  It shouldn't be.  Logically, it
should be protected by the ma_lock spinlock.  But today we use external
locking (ie the mmap_lock) because fixing that was a huge amount of work
that we didn't have time to do.

This MAP_VOLATILE idea is never going to fly.



      parent reply	other threads:[~2025-01-23 17:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-15 18:27 [PATCH v7 0/4] per-vma locks in userfaultfd Lokesh Gidra
2024-02-15 18:27 ` [PATCH v7 1/4] userfaultfd: move userfaultfd_ctx struct to header file Lokesh Gidra
2024-02-15 18:27 ` [PATCH v7 2/4] userfaultfd: protect mmap_changing with rw_sem in userfaulfd_ctx Lokesh Gidra
2024-02-15 18:27 ` [PATCH v7 3/4] mm: add vma_assert_locked() for !CONFIG_PER_VMA_LOCK Lokesh Gidra
2024-02-15 22:19   ` Suren Baghdasaryan
2024-02-15 18:27 ` [PATCH v7 4/4] userfaultfd: use per-vma locks in userfaultfd operations Lokesh Gidra
2025-01-23  4:14   ` Barry Song
2025-01-23 16:48     ` Lorenzo Stoakes
2025-01-23 17:07       ` Lorenzo Stoakes
2025-01-23 17:14       ` David Hildenbrand
2025-01-23 17:46         ` Suren Baghdasaryan
2025-01-23 16:52     ` Liam R. Howlett
2025-01-23 18:45       ` Lokesh Gidra
2025-01-27 22:08         ` Barry Song
2025-01-23 17:14     ` Matthew Wilcox [this message]

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=Z5J4__VslSFk3A78@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=21cnbao@gmail.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=axelrasmussen@google.com \
    --cc=bgeffon@google.com \
    --cc=david@redhat.com \
    --cc=jannh@google.com \
    --cc=kaleshsingh@google.com \
    --cc=kernel-team@android.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lokeshgidra@google.com \
    --cc=ngeoffray@google.com \
    --cc=peterx@redhat.com \
    --cc=rppt@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=selinux@vger.kernel.org \
    --cc=surenb@google.com \
    --cc=timmurray@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