diff mbox series

[1/3] khugepaged: use helper function range_in_vma() in collapse_pte_mapped_thp()

Message ID 20210325135647.64106-2-linmiaohe@huawei.com (mailing list archive)
State New, archived
Headers show
Series Cleanup for khugepaged | expand

Commit Message

Miaohe Lin March 25, 2021, 1:56 p.m. UTC
We could use helper function range_in_vma() to check whether the desired
range is inside the vma to simplify the code.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/khugepaged.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index b81521dfbb1a..ad0444f3f487 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -1446,7 +1446,7 @@  void collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr)
 	int i;
 
 	if (!vma || !vma->vm_file ||
-	    vma->vm_start > haddr || vma->vm_end < haddr + HPAGE_PMD_SIZE)
+	    !range_in_vma(vma, haddr, haddr + HPAGE_PMD_SIZE))
 		return;
 
 	/*