mm: hugetlb: fix __unmap_hugepage_range
Subsystems (2)
RFC PATCH 1/1 mm: hugetlb: fix __unmap_hugepage_range
First, after flushing TLB, we have no need to scan pte from start again. Second, before bail out loop, the address is forwarded one step.
---
mm/hugetlb.c +3 -1
@@ -2641,8 +2641,9 @@ void __unmap_hugepage_range(struct mmu_gtlb_start_vma (tlb, vma);mmu_notifier_invalidate_range_start (mm, mmun_start, mmun_end); + address = start; again: -for (address = start; address < end; address += sz) { +for (; address < end; address += sz) { ptep =huge_pte_offset (mm, address);if (!ptep)continue ;
@@ -2689,6 +2690,7 @@ again:page_remove_rmap (page); force_flush = !__tlb_remove_page (tlb, page);if (force_flush) { + address += sz;spin_unlock (ptl);break ; }
--
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
[CCing people involved in 24669e58477e2]
Quoted 2 lines · Hillf Danton
First, after flushing TLB, we have no need to scan pte from start again. Second, before bail out loop, the address is forwarded one step.
I can imagine a more comprehensive wording here. It is not immediately clear whether this is just an optimization or a bug fix as well (especially the second part).
Anyway the optimization looks good to me.
Quoted 1 line
Signed-off-by Hillf Danton <[email protected]>
Quoted 26 lines
---
mm/hugetlb.c +3
-2@@ -2641,8 +2641,9 @@ void __unmap_hugepage_range(struct mmu_gtlb_start_vma (tlb, vma);mmu_notifier_invalidate_range_start (mm, mmun_start, mmun_end); + address = start; again: -for (address = start; address < end; address += sz) { +for (; address < end; address += sz) { ptep =huge_pte_offset (mm, address);if (!ptep)continue ;@@ -2689,6 +2690,7 @@ again:page_remove_rmap (page); force_flush = !__tlb_remove_page (tlb, page);if (force_flush) { + address += sz;spin_unlock (ptl);break ; } --
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 4 lines · Hillf Danton
First, after flushing TLB, we have no need to scan pte from start again. Second, before bail out loop, the address is forwarded one step.
Signed-off-by Hillf Danton <[email protected]>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>