[PATCH v2 5/5] mm/filemap: Avoid retrying page faults on uptodate folios in filemap faults
Barry Song (Xiaomi)
baohua at kernel.org
Wed Apr 29 21:04:27 PDT 2026
For uptodate folios, we are not waiting on I/O. We should
be able to acquire the folio lock shortly, so there is no
need to drop per-vma locks and perform a full PF retry.
Signed-off-by: Barry Song (Xiaomi) <baohua at kernel.org>
---
mm/filemap.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/mm/filemap.c b/mm/filemap.c
index b532d6cbafc8..0d2f6af5d0fe 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -3533,6 +3533,13 @@ vm_fault_t filemap_fault(struct vm_fault *vmf)
}
}
+ /*
+ * If the folio is uptodate, we are likely only waiting for
+ * another concurrent PTE mapping to complete, which should
+ * be brief. No need to drop the lock and retry the fault.
+ */
+ if (folio_test_uptodate(folio))
+ vmf->flags &= ~FAULT_FLAG_ALLOW_RETRY;
if (!lock_folio_maybe_drop_mmap(vmf, folio, &fpin))
goto out_retry;
--
2.39.3 (Apple Git-146)
More information about the linux-riscv
mailing list