Skip to content

Commit b7333b5

Browse files
yang-shitorvalds
authored andcommitted
mm/memory.c: skip spurious TLB flush for retried page fault
Recently we found regression when running will_it_scale/page_fault3 test on ARM64. Over 70% down for the multi processes cases and over 20% down for the multi threads cases. It turns out the regression is caused by commit 89b1533 ("mm: drop mmap_sem before calling balance_dirty_pages() in write fault"). The test mmaps a memory size file then write to the mapping, this would make all memory dirty and trigger dirty pages throttle, that upstream commit would release mmap_sem then retry the page fault. The retried page fault would see correct PTEs installed then just fall through to spurious TLB flush. The regression is caused by the excessive spurious TLB flush. It is fine on x86 since x86's spurious TLB flush is no-op. We could just skip the spurious TLB flush to mitigate the regression. Suggested-by: Linus Torvalds <[email protected]> Reported-by: Xu Yu <[email protected]> Debugged-by: Xu Yu <[email protected]> Tested-by: Xu Yu <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Will Deacon <[email protected]> Cc: <[email protected]> Signed-off-by: Yang Shi <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 06a4ec1 commit b7333b5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

mm/memory.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4247,6 +4247,9 @@ static vm_fault_t handle_pte_fault(struct vm_fault *vmf)
42474247
vmf->flags & FAULT_FLAG_WRITE)) {
42484248
update_mmu_cache(vmf->vma, vmf->address, vmf->pte);
42494249
} else {
4250+
/* Skip spurious TLB flush for retried page fault */
4251+
if (vmf->flags & FAULT_FLAG_TRIED)
4252+
goto unlock;
42504253
/*
42514254
* This is needed only for protection faults but the arch code
42524255
* is not yet telling us if this is a protection fault or not.

0 commit comments

Comments
 (0)