From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6444A606A325 for ; Sun, 29 Nov 2026 20:22:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=KX3sAKkC Received: by kanga.kvack.org (Postfix) id 3DE8C6B05B2; Sun, 29 Nov 2026 15:22:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 341F76B05B6; Sun, 29 Nov 2026 15:22:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 230E76B05B7; Sun, 29 Nov 2026 15:22:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id ED5146B05B2 for ; Sun, 29 Nov 2026 15:22:14 -0500 (EST) Received: from smtpin16.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 761161408E9 for ; Sun, 29 Nov 2026 20:22:14 +0000 (UTC) X-FDA: 85489278588.16.F135F9C Received: from mail-dy1-f200.google.com (mail-dy1-f200.google.com [74.125.82.200]) by imf15.hostedemail.com (Postfix) with ESMTP id B2844A0012 for ; Sun, 29 Nov 2026 20:22:12 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20260707 header.b=KX3sAKkC; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf15.hostedemail.com: domain of 3c4kMawYKCBgGIF2Bz4CC492.0CA96BIL-AA8Jy08.CF4@flex--surenb.bounces.google.com designates 74.125.82.200 as permitted sender) smtp.mailfrom=3c4kMawYKCBgGIF2Bz4CC492.0CA96BIL-AA8Jy08.CF4@flex--surenb.bounces.google.com ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1795983732; b=IqZiolZ+wIO6EmA0uyfMgZMM6NbQvJLZfoPDIrvxWj23JUNzIA+6hnQHOSCA3jckH5CZiw wTc2aNyIREm/YkQuYcs44hmFMv5kebH5vrvSgOJq41mKzbqeoXFGQ7YTfhuPZgD79BCaX/ Z2EcJeruGmRvNzyIN8aLuFZtHoNEfh4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1795983732; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=+I087uAHFfr3vIi2QzJD6zDcj5fneQUT1cINxigykdY=; b=Gt7pjfeUCMGPU0g8YZUJvgt/XTl2BzVdWFcNUFaicVXsWuU0k4Y/uZvYJAsDNZi3tNbYSI Q5w68wj2fR1fTbTnbl6hP2koViyU8hFcyUpSzPRpvhWQnCLTgV+ACtrMJJKcvVCcd02EzL KiWcXHgB4kZj8yk3cQG65+ubALglgdY= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20260707 header.b=KX3sAKkC; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf15.hostedemail.com: domain of 3c4kMawYKCBgGIF2Bz4CC492.0CA96BIL-AA8Jy08.CF4@flex--surenb.bounces.google.com designates 74.125.82.200 as permitted sender) smtp.mailfrom=3c4kMawYKCBgGIF2Bz4CC492.0CA96BIL-AA8Jy08.CF4@flex--surenb.bounces.google.com Received: by mail-dy1-f200.google.com with SMTP id 5a478bee46e88-3846d5f54c1so10664794eec.1 for ; Sun, 29 Nov 2026 12:22:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1795983731; x=1796588531; darn=kvack.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=+I087uAHFfr3vIi2QzJD6zDcj5fneQUT1cINxigykdY=; b=KX3sAKkC4ald0YTipePO+EswGBLZYhP6OJX961u9VUKzOVRiGBFzocdmQk4Vp1R8op FtWxuKfLk7t2WcvWwh3AZ0NZjNUvavLEd7/iC7L1qTgghxnu7Dg/XuDlNa9GygTYQM+e 0/jWjoV0f7mwPUmzUkVJbkGcH40YJeW8SMa/Hf2kpE1efuAc/1R3OyoW4+cJXyy+ila/ 3Qfz4sBen1g88b8Lmcp10kAwdn2bYuwpWpXZrmVwSR6b6xv2UHldQ+rYZhlvl4NgC0E4 ISdVBMtf6Krcj/WhUgv0bhhAl8iIUQ7h1+1+YLYya20hnLkmoWQ5PNnCB+cklCRCK1q4 Aa5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795983731; x=1796588531; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=+I087uAHFfr3vIi2QzJD6zDcj5fneQUT1cINxigykdY=; b=SBTm7YQfX6HFd+aE9/emo/aVYwUtYU9EVdrJk2U3SI9NGMCgwI+IVtfjWx7H0YvV3m f4vA/dn/KOPoYYIJTlFCzcmDzfFUFKWfh9TSDhvWaEnOR0zv35GdPSTXzXfXRrI5jh/Q eLNtLeZ4k1KocMYWmK5IdEW9gLVxs3tPuVn6vwmyeI/9RGYEA8DL5Lb7Zp/AhFIbl2hq 8BLACWrL6ELhttyWBfXsOEn2HVuel771/Nv2r1zokjQ19QjsdGZxES6mmztEQ6Q7Y7Hf RyNwUB+qsTjMRdlPrSRqkX69Eoe/UUUBoNd9SnrmzlkVdqUfotHtU4aPKTEl/H1gyf81 X3ig== X-Forwarded-Encrypted: i=1; AL+hErGBkwt0Cjk/YQwvyOLAvvNt+V1AUAE69+nnJxUXENAd31B2E57Y3O93lq7M709u9i04Cl1LHZLHmA==@kvack.org X-Gm-Message-State: APuU4Z9/osruIkotbLPtyyBFjlfu5jFJ6bBZnYEhxoqcaE+f+01gPzYp YvlBX11tv7b1PzhW46ONm14FGLBzVUSQH4PZj/DXM0K2HgtjqB5khymqcAJW3Y2zRPzygfrIRBr DV0so6w== X-Received: from dybgk2.prod.google.com ([2002:a05:7301:182:b0:385:e49a:dd09]) (user=surenb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7301:6486:b0:378:1191:43ca with SMTP id 5a478bee46e88-3863f1355b2mr25913017eec.18.1795983731013; Sun, 29 Nov 2026 12:22:11 -0800 (PST) Date: Sun, 29 Nov 2026 12:22:03 -0800 In-Reply-To: <20261129202203.1183277-1-surenb@google.com> X-Archived-By: Mime-Version: 1.0 References: <20261129202203.1183277-1-surenb@google.com> X-Mailer: git-send-email 2.56.1.839.g22a8290db9-goog Message-ID: <20261129202203.1183277-3-surenb@google.com> Subject: [RFC PATCH 2/2] mm: split VM_FAULT_RETRY_LOCK_MM out of VM_FAULT_RETRY From: Suren Baghdasaryan 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 Content-Type: text/plain; charset="UTF-8" X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: B2844A0012 X-Stat-Signature: zb1gtxy4w5kkthot5x5jynswfkd5f7wz X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS,USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=4.0.1 X-HE-Tag: 1795983732-591851 X-HE-Meta: U2FsdGVkX1/NoMvUJMxvvR/TS6BLhJwryIDGJ919imjO6n7wW0ZtM3K6gUDooW9CanIZVfLFhh7+S0JuEqt0XXJ9UDzro6NEaNfU8GvUB42exQcq5b0hWJhMZePjzSweHRcLp+bXIz+zxtk0BB42qhLiYWy04fo/1WQ5TXV8ezDV2M72ctgjSuAe+MiuXccVUGDRc3fbgeM56bKl7UcDGGP4xf/Yn59t5mNFRUWxwrw+xoGyYO+GgQiz8DYd1QpSVu+rjRWeqb7pJj6O/2Iwt/s3Nv1mAsa/1sKgNm6VVJKFcYvKwEBlYw482nvhdYegB2sW23CCtTD8Cmpn8FB41sBWE9G2lMWMC3qG0fHKpNQFYdWzJHq8gE/8CZQH0tHyhmVeJN184mWVj2d50Gc4D462zyZTWGAI7OjjN+ztIEuPMgyhUVxYH8QY8lejVqkMN++u3e7Ne6jSrfVirimQPwtD9SllSUKgIgWax7nlUCvbHB1A/MUnGlTstv38Ey8x/J9k/A5fyZvTFuXfMltCiQNIdCkKahdsHAVIChaDfsb4uOljYxkIsC0dYTGe5xbu6gfG0NkpjDqkHq6Me+BhP7gfS9NimZttz5/pXdQneTjtA/ErjSSR6GRN/OMnMIHF/QOMjUHyXydw3X1BVRdHHZ6svWNTEbEIuoi8vUTJm8mN73spUIz+baBNJE+ba0ef5HI+G3rpAmrDpVVUUUSvNX+aVOjv9f6Q01Qb7YIqR8rkvwqif1+z5v5+p0GVLmRiqXanJlIrGol0eNllhVR3KTXUOqL3JFrsAyL7e4neNOXKMaiXl2vTahB09GDdNx2LTcnmhPS1lzEw3/WUAJJStq0zdEyTcSPG1dNkf+bdtjSIJX2d2l2gQYFefzT/dbBhNNFGSg5COTIagNG7zdlVyBQl4Zygvlr592lncxCBgZUkBUivVC69Yr6ha7f9AmLXRE88Qjmo+8M0CX9ZR93 Ng0hXzZn FCP0Smy1A78QIsm3QC0ajistxU/YY0J1Uikrv50qppHblZK3/JZUi+5uGmw+dKFWpexsszgP9SDq5+THbC4XmG1eI+vgrM9GzcCc9By2Gi47ZUPDXFzxHk8XhiCjJtRmcQtJhlgLq3DRwjafra94gy8CY2dQEwbme1SywK5UZSrE1vwzMoUY6jME+EWK2PyYXh1gfFY5rh2Amc1nWAbmU0N+R+6wQmHgJjb7NZqJeJhi+HGoggoV8SjZn1cEConDU24bQaVB8FoMTyP2k+T5VanIHNRhuIoxUO0uJgP0cnGPUbTFdUc5umrLSuWyjw1JSq911IT5F/GinZ6AqoFfVpWuYmbtVRHXVR+6wPVEya5jkg0bhzlkEoYOz8lwrbB6zb1YmAIcXspbUTofYTznSkoqtuiSSQl1TwoUM7Og3e7m8iyaPsp//U8v/Xo+XEXJQq2uxZkYpsuBKqqL0RTwFsDe7qJnYi60WHvVyPbZYZzt7G6hcyKcSwblZyCLhxrX9QeKcNoWQS292iA5dkL2ZyOf5IRnS/fnR58PNoQMyDDU0D2Gc2/M0ThB1y3SwYbSIpjGQHqsAqx6sfgRreRB6dJGYU6FU180d57iDb9E9K+5EY5qVvJuHjasrrUcBgZGbC5PAGRBzjXlbWZZUIXeFSv07t1/kFHh0I8S3NTb9Gj1vuVmzfk28cTeulk2Aw0UOEg5J2cKbP8RFlUPn7yMuf2dYGi7rZpFcpW4icz135QsSfwbMrn4UszY3QaoeU9ICL25kKBtWy/JD3timl3uN+jHGdsUziRMAX78efrOGuLAXA77gdRGtmKOGCukt9GWNrJIpy97KZWedsjxW/Pq9GUquiBLnsEOE0hK9SZwC0yqX0Juj6mGE+2W3jkf45cuPjVNV Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 VM_FAULT_RETRY is returned for two different reasons. It tells the caller that the fault handler had to drop its lock, usually to wait for something, so 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 caller can not tell these two cases apart. Introduce VM_FAULT_RETRY_LOCK_MM for the second case and return it where the fault handler falls back from the per-VMA lock to mmap_lock. Those cases are: - vmf_can_call_fault(), when the VMA has ->fault but no ->map_pages; - __vmf_anon_prepare(), when the VMA has no anon_vma yet and mmap_lock can not be taken without blocking; - do_swap_page() and do_huge_pmd_device_private(), because migrate_to_ram() is not ready to operate under the per-VMA lock. VM_FAULT_RETRY keeps being returned in all the other cases. vmf_anon_prepare() and hugetlb release the per-VMA lock based on the result of __vmf_anon_prepare(), so make them check the new code. should_retry_mm_fault() accepts both codes, so page fault handlers keep retrying under mmap_lock in both cases. VM_FAULT_RETRY_LOCK_MM is never returned for a fault that is handled under mmap_lock, so the checks done after such a fault are left unchanged. No functional change intended. Signed-off-by: Suren Baghdasaryan --- Documentation/filesystems/porting.rst | 4 ++-- include/linux/mm_types.h | 13 +++++++++++-- mm/huge_memory.c | 2 +- mm/hugetlb.c | 9 +++++---- mm/internal.h | 2 +- mm/memory.c | 18 ++++++++++-------- 6 files changed, 30 insertions(+), 18 deletions(-) diff --git a/Documentation/filesystems/porting.rst b/Documentation/filesystems/porting.rst index e41466904501..94db82f2195f 100644 --- a/Documentation/filesystems/porting.rst +++ b/Documentation/filesystems/porting.rst @@ -944,8 +944,8 @@ Calling convention for ->huge_fault has changed. It now takes a page order instead of an enum page_entry_size, and it may be called without the mmap_lock held. All in-tree users have been audited and do not seem to depend on the mmap_lock being held, but out of tree users should verify -for themselves. If they do need it, they can return VM_FAULT_RETRY to -be called with the mmap_lock held. +for themselves. If they do need it, they can drop the per-VMA lock and +return VM_FAULT_RETRY_LOCK_MM to be called with the mmap_lock held. --- diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 7a80c904eab9..b46a9dbfe2c8 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -1711,6 +1711,8 @@ typedef __bitwise unsigned int vm_fault_t; * fsync() to complete (for synchronous page faults * in DAX) * @VM_FAULT_COMPLETED: ->fault completed, meanwhile mmap lock released + * @VM_FAULT_RETRY_LOCK_MM: fault can not be handled under per-VMA lock, + * must retry under mmap_lock * @VM_FAULT_HINDEX_MASK: mask HINDEX value * */ @@ -1728,6 +1730,7 @@ enum vm_fault_reason { VM_FAULT_DONE_COW = (__force vm_fault_t)0x001000, VM_FAULT_NEEDDSYNC = (__force vm_fault_t)0x002000, VM_FAULT_COMPLETED = (__force vm_fault_t)0x004000, + VM_FAULT_RETRY_LOCK_MM = (__force vm_fault_t)0x008000, VM_FAULT_HINDEX_MASK = (__force vm_fault_t)0x0f0000, }; @@ -1743,12 +1746,17 @@ enum vm_fault_reason { * should_retry_mm_fault - Check whether a page fault has to be retried. * @fault: The fault result returned by handle_mm_fault(). * + * A fault handled under the per-VMA lock can fail with either + * VM_FAULT_RETRY_LOCK_MM, when it has to be handled under mmap_lock, or with + * VM_FAULT_RETRY for all the other reasons to retry. A fault handled under + * mmap_lock can only fail with the latter. + * * Return: true if the fault was not handled and the caller has to retry it, * false otherwise. */ static inline bool should_retry_mm_fault(vm_fault_t fault) { - return !!(fault & VM_FAULT_RETRY); + return !!(fault & (VM_FAULT_RETRY | VM_FAULT_RETRY_LOCK_MM)); } #define VM_FAULT_RESULT_TRACE \ @@ -1764,7 +1772,8 @@ static inline bool should_retry_mm_fault(vm_fault_t fault) { (__force u32)VM_FAULT_FALLBACK, "FALLBACK" }, \ { (__force u32)VM_FAULT_DONE_COW, "DONE_COW" }, \ { (__force u32)VM_FAULT_NEEDDSYNC, "NEEDDSYNC" }, \ - { (__force u32)VM_FAULT_COMPLETED, "COMPLETED" } + { (__force u32)VM_FAULT_COMPLETED, "COMPLETED" }, \ + { (__force u32)VM_FAULT_RETRY_LOCK_MM, "RETRY_LOCK_MM" } struct vm_special_mapping { const char *name; /* The name, e.g. "[vdso]". */ diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 4fc888ddfb69..23a5dfe05824 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1479,7 +1479,7 @@ vm_fault_t do_huge_pmd_device_private(struct vm_fault *vmf) if (vmf->flags & FAULT_FLAG_VMA_LOCK) { vma_end_read(vma); - return VM_FAULT_RETRY; + return VM_FAULT_RETRY_LOCK_MM; } ptl = pmd_lock(vma->vm_mm, vmf->pmd); diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 4386425b5ce5..4f3eea0b1e67 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -6130,9 +6130,9 @@ static vm_fault_t hugetlb_no_page(struct address_space *mapping, /* * We must check to release the per-VMA lock. __vmf_anon_prepare() is - * the only way ret can be set to VM_FAULT_RETRY. + * the only way ret can be set to VM_FAULT_RETRY_LOCK_MM. */ - if (unlikely(ret & VM_FAULT_RETRY)) + if (unlikely(ret & VM_FAULT_RETRY_LOCK_MM)) vma_end_read(vma); mutex_unlock(&hugetlb_fault_mutex_table[hash]); @@ -6391,9 +6391,10 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, /* * We must check to release the per-VMA lock. __vmf_anon_prepare() in - * hugetlb_wp() is the only way ret can be set to VM_FAULT_RETRY. + * hugetlb_wp() is the only way ret can be set to + * VM_FAULT_RETRY_LOCK_MM. */ - if (unlikely(ret & VM_FAULT_RETRY)) + if (unlikely(ret & VM_FAULT_RETRY_LOCK_MM)) vma_end_read(vma); mutex_unlock(&hugetlb_fault_mutex_table[hash]); diff --git a/mm/internal.h b/mm/internal.h index f865d7b0c94b..a65192d8358d 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -574,7 +574,7 @@ static inline vm_fault_t vmf_anon_prepare(struct vm_fault *vmf) { vm_fault_t ret = __vmf_anon_prepare(vmf); - if (unlikely(ret & VM_FAULT_RETRY)) + if (unlikely(ret & VM_FAULT_RETRY_LOCK_MM)) vma_end_read(vmf->vma); return ret; } diff --git a/mm/memory.c b/mm/memory.c index e0f1aeed713c..682d1167eb49 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4021,7 +4021,7 @@ static inline vm_fault_t vmf_can_call_fault(const struct vm_fault *vmf) if (vma->vm_ops->map_pages || !(vmf->flags & FAULT_FLAG_VMA_LOCK)) return 0; vma_end_read(vma); - return VM_FAULT_RETRY; + return VM_FAULT_RETRY_LOCK_MM; } /** @@ -4037,7 +4037,8 @@ static inline vm_fault_t vmf_can_call_fault(const struct vm_fault *vmf) * do with only the per-VMA lock held for this VMA. * * Return: 0 if fault handling can proceed. Any other value should be - * returned to the caller. + * returned to the caller. VM_FAULT_RETRY_LOCK_MM is returned with the + * per-VMA lock still held if the fault has to be retried under mmap_lock. */ vm_fault_t __vmf_anon_prepare(struct vm_fault *vmf) { @@ -4048,7 +4049,7 @@ vm_fault_t __vmf_anon_prepare(struct vm_fault *vmf) return 0; if (vmf->flags & FAULT_FLAG_VMA_LOCK) { if (!mmap_read_trylock(vma->vm_mm)) - return VM_FAULT_RETRY; + return VM_FAULT_RETRY_LOCK_MM; } if (__anon_vma_prepare(vma)) ret = VM_FAULT_OOM; @@ -5046,7 +5047,7 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) * under VMA lock. */ vma_end_read(vma); - ret = VM_FAULT_RETRY; + ret = VM_FAULT_RETRY_LOCK_MM; goto out; } @@ -6744,9 +6745,9 @@ static vm_fault_t handle_pte_fault(struct vm_fault *vmf) /* * On entry, we hold either the VMA lock or the mmap_lock - * (see FAULT_FLAG_VMA_LOCK). If VM_FAULT_RETRY is set in - * the result, the lock is not held on exit. See filemap_fault() - * and __folio_lock_or_retry(). + * (see FAULT_FLAG_VMA_LOCK). If VM_FAULT_RETRY or + * VM_FAULT_RETRY_LOCK_MM is set in the result, the lock is not held + * on exit. See filemap_fault() and __folio_lock_or_retry(). */ static vm_fault_t __handle_mm_fault(struct vm_area_struct *vma, unsigned long address, unsigned int flags) @@ -6966,7 +6967,8 @@ static vm_fault_t sanitize_fault_flags(struct vm_area_struct *vma, } /* * Per-VMA locks can't be used with FAULT_FLAG_RETRY_NOWAIT because of - * the assumption that lock is dropped on VM_FAULT_RETRY. + * the assumption that lock is dropped on VM_FAULT_RETRY and + * VM_FAULT_RETRY_LOCK_MM. */ if (WARN_ON_ONCE((*flags & (FAULT_FLAG_VMA_LOCK | FAULT_FLAG_RETRY_NOWAIT)) == -- 2.56.1.839.g22a8290db9-goog