From: Suren Baghdasaryan <surenb@google.com>
To: akpm@linux-foundation.org
Cc: david@kernel.org, willy@infradead.org, ljs@kernel.org,
liam@infradead.org, vbabka@kernel.org, rppt@kernel.org,
jannh@google.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com,
nico.pache@linux.dev, ryan.roberts@arm.com, dev.jain@arm.com,
baohua@kernel.org, lance.yang@linux.dev, usama.arif@linux.dev,
kas@kernel.org, muchun.song@linux.dev, osalvador@suse.de,
dave.hansen@linux.intel.com, luto@kernel.org,
peterz@infradead.org, linux@armlinux.org.uk,
catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com,
chenhuacai@kernel.org, kernel@xen0n.name, maddy@linux.ibm.com,
mpe@ellerman.id.au, npiggin@gmail.com, chleroy@kernel.org,
ritesh.list@gmail.com, sshegde@linux.ibm.com, pjw@kernel.org,
palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr,
agordeev@linux.ibm.com, gerald.schaefer@linux.ibm.com,
corbet@lwn.net, skhan@linuxfoundation.org,
rdunlap@infradead.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev,
linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org,
linux-s390@vger.kernel.org, linux-doc@vger.kernel.org,
Suren Baghdasaryan <surenb@google.com>
Subject: [RFC PATCH 0/2] mm: separate the fallback to mmap_lock from VM_FAULT_RETRY
Date: Sun, 29 Nov 2026 12:22:01 -0800 [thread overview]
Message-ID: <20261129202203.1183277-1-surenb@google.com> (raw)
VM_FAULT_RETRY is returned from the page fault path for two different
reasons. Usually it means that the fault handler had to drop its lock,
typically to wait for something, and the fault has to be handled again.
With per-VMA locks it is also returned when the fault can not be handled
under the per-VMA lock at all and has to be handled under mmap_lock. The
architecture fault handlers can not tell these two cases apart, so every
VM_FAULT_RETRY from a fault handled under the per-VMA lock results in a
retry under mmap_lock.
This series separates the two cases:
Patch 1 introduces should_retry_mm_fault() and uses it in the per-VMA lock
path of the architecture fault handlers, in fault_signal_pending() and in
mm_account_fault() instead of testing VM_FAULT_RETRY directly.
Patch 2 introduces VM_FAULT_RETRY_LOCK_MM and returns it from the places
that fall back from the per-VMA lock to mmap_lock: vmf_can_call_fault(),
__vmf_anon_prepare() and the device private paths in do_swap_page() and
do_huge_pmd_device_private(). VM_FAULT_RETRY keeps being returned in all
the other cases.
should_retry_mm_fault() accepts both codes and the architecture fault
handlers keep retrying under mmap_lock in both cases, so no functional
change is intended. The series only makes the reason for the retry
visible to the callers of handle_mm_fault().
Only the checks in the per-VMA lock path are converted. The checks done
after handling a fault under mmap_lock still test VM_FAULT_RETRY, since
VM_FAULT_RETRY_LOCK_MM is never returned there.
Drivers and filesystems that return VM_FAULT_RETRY are left unchanged.
panthor_gem_any_fault() might return it after dropping the per-VMA lock
and waiting, which is treated as a generic retry.
The series is based on mm-unstable.
Suren Baghdasaryan (2):
mm: introduce should_retry_mm_fault() helper
mm: split VM_FAULT_RETRY_LOCK_MM out of VM_FAULT_RETRY
Documentation/filesystems/porting.rst | 4 ++--
arch/arm/mm/fault.c | 4 ++--
arch/arm64/mm/fault.c | 4 ++--
arch/loongarch/mm/fault.c | 4 ++--
arch/powerpc/mm/fault.c | 4 ++--
arch/riscv/mm/fault.c | 4 ++--
arch/s390/mm/fault.c | 4 ++--
arch/x86/mm/fault.c | 4 ++--
include/linux/mm_types.h | 23 ++++++++++++++++++++++-
include/linux/sched/signal.h | 2 +-
mm/huge_memory.c | 2 +-
mm/hugetlb.c | 9 +++++----
mm/internal.h | 2 +-
mm/memory.c | 20 +++++++++++---------
14 files changed, 57 insertions(+), 33 deletions(-)
base-commit: 890dc639d8a33e674caa7ea9993dbd2416660447
--
2.56.1.839.g22a8290db9-goog
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next reply other threads:[~2026-11-29 20:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 20:22 Suren Baghdasaryan [this message]
2026-11-29 20:22 ` [RFC PATCH 1/2] mm: introduce should_retry_mm_fault() helper Suren Baghdasaryan
2026-11-29 20:22 ` [RFC PATCH 2/2] mm: split VM_FAULT_RETRY_LOCK_MM out of VM_FAULT_RETRY Suren Baghdasaryan
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=20261129202203.1183277-1-surenb@google.com \
--to=surenb@google.com \
--cc=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=catalin.marinas@arm.com \
--cc=chenhuacai@kernel.org \
--cc=chleroy@kernel.org \
--cc=corbet@lwn.net \
--cc=dave.hansen@linux.intel.com \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=gerald.schaefer@linux.ibm.com \
--cc=jannh@google.com \
--cc=kas@kernel.org \
--cc=kernel@xen0n.name \
--cc=lance.yang@linux.dev \
--cc=liam@infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=ljs@kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=luto@kernel.org \
--cc=maddy@linux.ibm.com \
--cc=mark.rutland@arm.com \
--cc=mpe@ellerman.id.au \
--cc=muchun.song@linux.dev \
--cc=nico.pache@linux.dev \
--cc=npiggin@gmail.com \
--cc=osalvador@suse.de \
--cc=palmer@dabbelt.com \
--cc=peterz@infradead.org \
--cc=pjw@kernel.org \
--cc=rdunlap@infradead.org \
--cc=ritesh.list@gmail.com \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=skhan@linuxfoundation.org \
--cc=sshegde@linux.ibm.com \
--cc=usama.arif@linux.dev \
--cc=vbabka@kernel.org \
--cc=will@kernel.org \
--cc=willy@infradead.org \
--cc=ziy@nvidia.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