mm: use update_mmu_tlb_range() to simplify code

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>
This commit is contained in:
Bang Li 2024-05-22 14:12:04 +08:00 committed by Andrew Morton
parent 8f65aa3223
commit 6faa49d1c4

View File

@ -4457,7 +4457,6 @@ static vm_fault_t do_anonymous_page(struct vm_fault *vmf)
vm_fault_t ret = 0; vm_fault_t ret = 0;
int nr_pages = 1; int nr_pages = 1;
pte_t entry; pte_t entry;
int i;
/* File mapping without ->vm_ops ? */ /* File mapping without ->vm_ops ? */
if (vma->vm_flags & VM_SHARED) if (vma->vm_flags & VM_SHARED)
@ -4527,8 +4526,7 @@ static vm_fault_t do_anonymous_page(struct vm_fault *vmf)
update_mmu_tlb(vma, addr, vmf->pte); update_mmu_tlb(vma, addr, vmf->pte);
goto release; goto release;
} else if (nr_pages > 1 && !pte_range_none(vmf->pte, nr_pages)) { } else if (nr_pages > 1 && !pte_range_none(vmf->pte, nr_pages)) {
for (i = 0; i < nr_pages; i++) update_mmu_tlb_range(vma, addr, vmf->pte, nr_pages);
update_mmu_tlb(vma, addr + PAGE_SIZE * i, vmf->pte + i);
goto release; goto release;
} }