From: Bang Li libang.li@antgroup.com
mainline inclusion from mainline-v6.11-rc1 commit 6faa49d1c4404e0b949fd92f1e891c24870d4f86 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IAIHPC
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
--------------------------------
Let us simplify the code by update_mmu_tlb_range().
Link: https://lkml.kernel.org/r/20240522061204.117421-4-libang.li@antgroup.com Signed-off-by: Bang Li libang.li@antgroup.com Reviewed-by: Lance Yang ioworker0@gmail.com Acked-by: David Hildenbrand david@redhat.com Cc: Chris Zankel chris@zankel.net Cc: Huacai Chen chenhuacai@kernel.org Cc: Max Filippov jcmvbkbc@gmail.com Cc: Palmer Dabbelt palmer@dabbelt.com Cc: Paul Walmsley paul.walmsley@sifive.com Cc: Ryan Roberts ryan.roberts@arm.com Cc: Thomas Bogendoerfer tsbogend@alpha.franken.de Signed-off-by: Andrew Morton akpm@linux-foundation.org Signed-off-by: Liu Shixin liushixin2@huawei.com --- mm/memory.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/mm/memory.c b/mm/memory.c index 7fd1f71cebeb..1597718ed30e 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4411,7 +4411,6 @@ static vm_fault_t do_anonymous_page(struct vm_fault *vmf) vm_fault_t ret = 0; int nr_pages = 1; pte_t entry; - int i;
/* File mapping without ->vm_ops ? */ if (vma->vm_flags & VM_SHARED) @@ -4481,8 +4480,7 @@ static vm_fault_t do_anonymous_page(struct vm_fault *vmf) update_mmu_tlb(vma, addr, vmf->pte); goto release; } else if (nr_pages > 1 && !pte_range_none(vmf->pte, nr_pages)) { - for (i = 0; i < nr_pages; i++) - update_mmu_tlb(vma, addr + PAGE_SIZE * i, vmf->pte + i); + update_mmu_tlb_range(vma, addr, vmf->pte, nr_pages); goto release; }