diff --git a/mm/hugetlb.c b/mm/hugetlb.c index e0fda156f0212a1a44c0d27f13dc8ffd1cda1064..db861d8b6c2824f460cc177f0d4008fd8850cc3e 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -699,6 +699,11 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, dst_pte = huge_pte_alloc(dst, addr); if (!dst_pte) goto nomem; + + /* If the pagetables are shared don't copy or take references */ + if (dst_pte == src_pte) + continue; + spin_lock(&dst->page_table_lock); spin_lock(&src->page_table_lock); if (!pte_none(*src_pte)) {