All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mm: Report success more often from filemap_map_folio_range()
@ 2023-09-20  3:53 Matthew Wilcox (Oracle)
  2023-09-20  3:53 ` [PATCH 2/2] mm: Abstract moving to the next PFN Matthew Wilcox (Oracle)
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Matthew Wilcox (Oracle) @ 2023-09-20  3:53 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Matthew Wilcox (Oracle),
	linux-mm, Yin Fengwei, Dave Hansen, David Hildenbrand,
	Thomas Gleixner

Even though we had successfully mapped the relevant page, we would
rarely return success from filemap_map_folio_range().  That leads to
falling back from the VMA lock path to the mmap_lock path, which is a
speed & scalability issue.  Found by inspection.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Fixes: 617c28ecab22 ("filemap: batch PTE mappings")
---
 mm/filemap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 582f5317ff71..580d0b2b1a7c 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -3506,7 +3506,7 @@ static vm_fault_t filemap_map_folio_range(struct vm_fault *vmf,
 		if (count) {
 			set_pte_range(vmf, folio, page, count, addr);
 			folio_ref_add(folio, count);
-			if (in_range(vmf->address, addr, count))
+			if (in_range(vmf->address, addr, count * PAGE_SIZE))
 				ret = VM_FAULT_NOPAGE;
 		}
 
@@ -3520,7 +3520,7 @@ static vm_fault_t filemap_map_folio_range(struct vm_fault *vmf,
 	if (count) {
 		set_pte_range(vmf, folio, page, count, addr);
 		folio_ref_add(folio, count);
-		if (in_range(vmf->address, addr, count))
+		if (in_range(vmf->address, addr, count * PAGE_SIZE))
 			ret = VM_FAULT_NOPAGE;
 	}
 
-- 
2.40.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-09-20 16:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-20  3:53 [PATCH 1/2] mm: Report success more often from filemap_map_folio_range() Matthew Wilcox (Oracle)
2023-09-20  3:53 ` [PATCH 2/2] mm: Abstract moving to the next PFN Matthew Wilcox (Oracle)
2023-09-20  4:07   ` Matthew Wilcox
2023-09-20  9:19   ` kernel test robot
2023-09-20  4:09 ` Matthew Wilcox (Oracle)
2023-09-20  4:32   ` Yin Fengwei
2023-09-20 16:52   ` Andrew Morton
2023-09-20  4:31 ` [PATCH 1/2] mm: Report success more often from filemap_map_folio_range() Yin Fengwei

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.