Skip to content

Commit 12710fd

Browse files
mjkravetzakpm00
authored andcommitted
hugetlb: rename vma_shareable() and refactor code
Rename the routine vma_shareable to vma_addr_pmd_shareable as it is checking a specific address within the vma. Refactor code to check if an aligned range is shareable as this will be needed in a subsequent patch. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Mike Kravetz <[email protected]> Reviewed-by: Miaohe Lin <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: "Aneesh Kumar K.V" <[email protected]> Cc: Axel Rasmussen <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Davidlohr Bueso <[email protected]> Cc: James Houghton <[email protected]> Cc: "Kirill A. Shutemov" <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Mina Almasry <[email protected]> Cc: Muchun Song <[email protected]> Cc: Naoya Horiguchi <[email protected]> Cc: Pasha Tatashin <[email protected]> Cc: Peter Xu <[email protected]> Cc: Prakash Sangappa <[email protected]> Cc: Sven Schnelle <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent c862722 commit 12710fd

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

mm/hugetlb.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6640,26 +6640,33 @@ static unsigned long page_table_shareable(struct vm_area_struct *svma,
66406640
return saddr;
66416641
}
66426642

6643-
static bool vma_shareable(struct vm_area_struct *vma, unsigned long addr)
6643+
static bool __vma_aligned_range_pmd_shareable(struct vm_area_struct *vma,
6644+
unsigned long start, unsigned long end)
66446645
{
6645-
unsigned long base = addr & PUD_MASK;
6646-
unsigned long end = base + PUD_SIZE;
6647-
66486646
/*
66496647
* check on proper vm_flags and page table alignment
66506648
*/
6651-
if (vma->vm_flags & VM_MAYSHARE && range_in_vma(vma, base, end))
6649+
if (vma->vm_flags & VM_MAYSHARE && range_in_vma(vma, start, end))
66526650
return true;
66536651
return false;
66546652
}
66556653

6654+
static bool vma_addr_pmd_shareable(struct vm_area_struct *vma,
6655+
unsigned long addr)
6656+
{
6657+
unsigned long start = addr & PUD_MASK;
6658+
unsigned long end = start + PUD_SIZE;
6659+
6660+
return __vma_aligned_range_pmd_shareable(vma, start, end);
6661+
}
6662+
66566663
bool want_pmd_share(struct vm_area_struct *vma, unsigned long addr)
66576664
{
66586665
#ifdef CONFIG_USERFAULTFD
66596666
if (uffd_disable_huge_pmd_share(vma))
66606667
return false;
66616668
#endif
6662-
return vma_shareable(vma, addr);
6669+
return vma_addr_pmd_shareable(vma, addr);
66636670
}
66646671

66656672
/*

0 commit comments

Comments
 (0)