[PATCH v4 3/3] mm: Use update_mmu_tlb_range() to simplify code

Bang Li libang.li at antgroup.com
Tue May 21 23:12:04 PDT 2024


Let us simplify the code by update_mmu_tlb_range().

Reviewed-by: Lance Yang <ioworker0 at gmail.com>
Acked-by: David Hildenbrand <david at redhat.com>
Signed-off-by: Bang Li <libang.li at antgroup.com>
---
 mm/memory.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index b5453b86ec4b..1297474546d6 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -4416,7 +4416,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)
@@ -4486,8 +4485,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;
 	}
 
-- 
2.19.1.6.gb485710b




More information about the linux-riscv mailing list