diff mbox series

[3/4] mm: mark PTEs referencing the accessed folio young

Message ID 20230530080731.1462122-4-fengwei.yin@intel.com (mailing list archive)
State New
Headers show
Series New page table range API fixup patches | expand

Commit Message

Yin, Fengwei May 30, 2023, 8:07 a.m. UTC
To allow using larger TLB entries, it's better to mark the
PTEs of same folio accessed when setup the PTEs.

Reported-by: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
---
 mm/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/mm/memory.c b/mm/memory.c
index c359fb8643e5..2615ea552613 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -4259,7 +4259,7 @@  void set_pte_range(struct vm_fault *vmf, struct folio *folio,
 	struct vm_area_struct *vma = vmf->vma;
 	bool uffd_wp = pte_marker_uffd_wp(vmf->orig_pte);
 	bool write = vmf->flags & FAULT_FLAG_WRITE;
-	bool prefault = vmf->address != addr;
+	bool prefault = (addr > vmf->address) || ((addr + nr) < vmf->address);
 	pte_t entry;
 
 	flush_icache_pages(vma, page, nr);