]> 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>
Wed, 17 Aug 2022 20:58:37 +0000 (13:58 -0700)
commitb9777820a8c0a7847812f444ab77d7ddd005b673
treedc8cfc80876bf41c7a27de3d3ffb76f361ce9020
parent9322ef37f64d8c569492e5bf023f8a6d20f36598
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>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/hugetlb.c