]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/hugetlb: make detecting shared pte more reliable
authorMiaohe Lin <linmiaohe@huawei.com>
Tue, 16 Aug 2022 13:05:53 +0000 (21:05 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 22 Aug 2022 22:58:05 +0000 (15:58 -0700)
commit4747949b14265ce4957fe1472efe0ff3c1ec9cbc
tree12fa6aaa324e9ba4601198cf248afcb7419a8f0d
parent1635b79c42dc1b00e0e0ccea87083eeecbea0668
mm/hugetlb: make detecting shared pte more reliable

If the pagetables are shared, we shouldn't copy or take references.  Since
src could have unshared and dst shares with another vma, huge_pte_none()
is thus used to determine whether dst_pte is shared.  But this check isn't
reliable.  A shared pte could have pte none in pagetable in fact.  The
page count of ptep page should be checked here in order to reliably
determine whether pte is shared.

Link: https://lkml.kernel.org/r/20220816130553.31406-7-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/hugetlb.c