@@ -3795,7 +3795,7 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
37953795 src_pte = huge_pte_offset (src , addr , sz );
37963796 if (!src_pte )
37973797 continue ;
3798- dst_pte = huge_pte_alloc (dst , addr , sz );
3798+ dst_pte = huge_pte_alloc (dst , vma , addr , sz );
37993799 if (!dst_pte ) {
38003800 ret = - ENOMEM ;
38013801 break ;
@@ -4563,7 +4563,7 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
45634563 */
45644564 mapping = vma -> vm_file -> f_mapping ;
45654565 i_mmap_lock_read (mapping );
4566- ptep = huge_pte_alloc (mm , haddr , huge_page_size (h ));
4566+ ptep = huge_pte_alloc (mm , vma , haddr , huge_page_size (h ));
45674567 if (!ptep ) {
45684568 i_mmap_unlock_read (mapping );
45694569 return VM_FAULT_OOM ;
@@ -5370,9 +5370,9 @@ void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma,
53705370 * if !vma_shareable check at the beginning of the routine. i_mmap_rwsem is
53715371 * only required for subsequent processing.
53725372 */
5373- pte_t * huge_pmd_share (struct mm_struct * mm , unsigned long addr , pud_t * pud )
5373+ pte_t * huge_pmd_share (struct mm_struct * mm , struct vm_area_struct * vma ,
5374+ unsigned long addr , pud_t * pud )
53745375{
5375- struct vm_area_struct * vma = find_vma (mm , addr );
53765376 struct address_space * mapping = vma -> vm_file -> f_mapping ;
53775377 pgoff_t idx = ((addr - vma -> vm_start ) >> PAGE_SHIFT ) +
53785378 vma -> vm_pgoff ;
@@ -5450,7 +5450,8 @@ int huge_pmd_unshare(struct mm_struct *mm, struct vm_area_struct *vma,
54505450}
54515451#define want_pmd_share () (1)
54525452#else /* !CONFIG_ARCH_WANT_HUGE_PMD_SHARE */
5453- pte_t * huge_pmd_share (struct mm_struct * mm , unsigned long addr , pud_t * pud )
5453+ pte_t * huge_pmd_share (struct mm_struct * mm , struct vm_area_struct * vma ,
5454+ unsigned long addr , pud_t * pud )
54545455{
54555456 return NULL ;
54565457}
@@ -5469,7 +5470,7 @@ void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma,
54695470#endif /* CONFIG_ARCH_WANT_HUGE_PMD_SHARE */
54705471
54715472#ifdef CONFIG_ARCH_WANT_GENERAL_HUGETLB
5472- pte_t * huge_pte_alloc (struct mm_struct * mm ,
5473+ pte_t * huge_pte_alloc (struct mm_struct * mm , struct vm_area_struct * vma ,
54735474 unsigned long addr , unsigned long sz )
54745475{
54755476 pgd_t * pgd ;
@@ -5488,7 +5489,7 @@ pte_t *huge_pte_alloc(struct mm_struct *mm,
54885489 } else {
54895490 BUG_ON (sz != PMD_SIZE );
54905491 if (want_pmd_share () && pud_none (* pud ))
5491- pte = huge_pmd_share (mm , addr , pud );
5492+ pte = huge_pmd_share (mm , vma , addr , pud );
54925493 else
54935494 pte = (pte_t * )pmd_alloc (mm , pud , addr );
54945495 }
0 commit comments