From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Rik van Riel <riel@surriel.com>,
linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Cc: kernel-team@meta.com, Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
linux-mm@kvack.org
Subject: Re: [PATCH v3 0/6] mm: access remote process memory under the per-VMA lock
Date: Tue, 21 Jul 2026 20:12:38 +0200 [thread overview]
Message-ID: <cbecbce0-475e-4817-bdda-d1f4c89698d0@kernel.org> (raw)
In-Reply-To: <20260717170036.743149-1-riel@surriel.com>
On 7/17/26 19:00, Rik van Riel wrote:
> __access_remote_vm() holds mmap_read_lock() for the whole transfer. On
> large machines with large multi-threaded applications, the mmap_lock
> is often contended due to mixed accesses from readers and writers, like
> mmap and munmap. When a lock holder gets stuck, system monitoring software
> can get stuck behind that, resulting in a failure to log that the system
> is in trouble.
>
> Take the per-VMA lock in __access_remote_vm() when the access falls
> entirely within a single VMA. Fall back to the mmap lock when the access
> crosses a VMA boundary, or when the page cannot be reached under the
> per-VMA lock: a dropped fault, a userfaultfd VMA, a hard error, or memory
> with no struct page that has to go through vma->vm_ops->access().
>
> The bulk of the work is a new gup helper. __access_remote_vm() needs a
> single page from a VMA it has already looked up and locked, faulting it in
> when necessary, under either lock.
Yes, much better.
>
> get_user_pages_remote() does not fit: it hard codes the mmap lock and
> re-derives the VMA. get_user_page_vma() walks the page tables, faults a
> missing page in, and returns it with a reference and the caller's lock
> still held.
Agreed, and that can be tackled later.
>
> The per-VMA path also closes a pre-existing gap. A COWed page in a
> VM_IO/VM_PFNMAP VMA has a struct page, but the old code routed it to
> ->access(), where generic_access_phys() ioremaps the PFN and ioremap of RAM
> is rejected, so the read came up short.
Yep. The GUP code rejected VM_IO/VM_PFNMAP for, though, because it did not
properly handle vm_normal_page_pmd() etc so far.
>
> get_user_page_vma() now returns that page normally. Raw PFNs with no struct
> page still reach ->access() under the mmap lock, as before.
>
> The series is arranged as:
It will take me a bit to dig into the details; I'll be out the remainder of the
week. But the general direction sounds good.
--
Cheers,
David
next prev parent reply other threads:[~2026-07-21 18:13 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 17:00 [PATCH v3 0/6] mm: access remote process memory under the per-VMA lock Rik van Riel
2026-07-17 17:00 ` [PATCH RFC v3 1/6] x86/mm: add untagged_addr_remote_unlocked() Rik van Riel
2026-07-20 11:12 ` Usama Arif
2026-07-17 17:00 ` [PATCH RFC v3 2/6] riscv/mm: " Rik van Riel
2026-07-20 11:57 ` Usama Arif
2026-07-20 15:08 ` Rik van Riel
2026-07-20 16:46 ` Usama Arif
2026-07-20 17:34 ` Rik van Riel
2026-07-20 18:46 ` Usama Arif
2026-07-20 19:21 ` Rik van Riel
2026-07-20 19:39 ` Usama Arif
2026-07-17 17:00 ` [PATCH RFC v3 3/6] mm: rename get_user_page_vma_remote() to get_user_page_lookup_vma() Rik van Riel
2026-07-20 12:00 ` Usama Arif
2026-07-17 17:00 ` [PATCH RFC v3 4/6] mm/gup: add get_user_page_vma() to fault in a page under a held lock Rik van Riel
2026-07-20 12:35 ` Usama Arif
2026-07-20 15:24 ` Rik van Riel
2026-07-17 17:00 ` [PATCH RFC v3 5/6] mm: use per-VMA lock in __access_remote_vm() for single-VMA accesses Rik van Riel
2026-07-17 17:00 ` [PATCH RFC v3 6/6] selftests/mm: cover /proc/pid/mem access to VM_PFNMAP memory Rik van Riel
2026-07-21 18:12 ` David Hildenbrand (Arm) [this message]
2026-07-22 17:33 ` [PATCH v3 0/6] mm: access remote process memory under the per-VMA lock Rik van Riel
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=cbecbce0-475e-4817-bdda-d1f4c89698d0@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=kernel-team@meta.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=riel@surriel.com \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
/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