]> 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>
Fri, 26 Aug 2022 05:02:55 +0000 (22:02 -0700)
commit1f273ce07e47ca7b7520fd67de7668a360c5c122
tree13a602d5638915987cbabc45151253343c509c60
parentdb60296cda7e6498150675f254bff3a8f5d48e0f
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