Skip to contentSkip to conversation

mm/hugetlb: use helper function range_in_vma() in page_table_shareable()

PATCH Applied Miaohe Lin 2 participants 2 messages Feb 4, 2021

Subsystems (2)
lore
Share & tools
lore

Miaohe Lin

author
#0 lore raw

PATCH 1/1 mm/hugetlb: use helper function range_in_vma() in page_table_shareable()

We could use helper function range_in_vma() to check whether the vma is in the desired range to simplify the code.

---
 mm/hugetlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/hugetlb.c +1 -1
index cf82629319ed..442705be052a 100644
@@ -5237,7 +5237,7 @@ static unsigned long page_table_shareable(struct vm_area_struct *svma,
 	 */
 	if (pmd_index(addr) != pmd_index(saddr) ||
 	    vm_flags != svm_flags ||
-	    sbase < svma->vm_start || svma->vm_end < s_end)
+	    !range_in_vma(svma, sbase, s_end))
 		return 0;
 
 	return saddr;
Signature · 1 line
2.19.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Miaohe Lin

We could use helper function range_in_vma() to check whether the vma is in the desired range to simplify the code.

---
 mm/hugetlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks,

Signature · 1 line
Mike Kravetz
Quoted 15 lines
mm/hugetlb.c +1 -1
index cf82629319ed..442705be052a 100644
@@ -5237,7 +5237,7 @@ static unsigned long page_table_shareable(struct vm_area_struct *svma,
 	 */
 	if (pmd_index(addr) != pmd_index(saddr) ||
 	    vm_flags != svm_flags ||
-	    sbase < svma->vm_start || svma->vm_end < s_end)
+	    !range_in_vma(svma, sbase, s_end))
 		return 0;
 
 	return saddr;