Commit 3aa4ed8
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.
[lukas.bulwahn@gmail.com: remove unused local variable dst_entry in copy_hugetlb_page_range()]
Link: https://lkml.kernel.org/r/20220822082525.26071-1-lukas.bulwahn@gmail.com
Link: https://lkml.kernel.org/r/20220816130553.31406-7-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>1 parent 01088a6 commit 3aa4ed8
1 file changed
+8
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4750 | 4750 | | |
4751 | 4751 | | |
4752 | 4752 | | |
4753 | | - | |
| 4753 | + | |
4754 | 4754 | | |
4755 | 4755 | | |
4756 | 4756 | | |
| |||
4795 | 4795 | | |
4796 | 4796 | | |
4797 | 4797 | | |
4798 | | - | |
4799 | 4798 | | |
| 4799 | + | |
4800 | 4800 | | |
4801 | | - | |
4802 | | - | |
4803 | | - | |
| 4801 | + | |
| 4802 | + | |
4804 | 4803 | | |
4805 | | - | |
4806 | | - | |
| 4804 | + | |
4807 | 4805 | | |
4808 | 4806 | | |
4809 | 4807 | | |
| |||
4812 | 4810 | | |
4813 | 4811 | | |
4814 | 4812 | | |
4815 | | - | |
4816 | 4813 | | |
4817 | | - | |
| 4814 | + | |
4818 | 4815 | | |
4819 | | - | |
4820 | | - | |
4821 | | - | |
| 4816 | + | |
4822 | 4817 | | |
4823 | 4818 | | |
4824 | 4819 | | |
| |||
4897 | 4892 | | |
4898 | 4893 | | |
4899 | 4894 | | |
4900 | | - | |
| 4895 | + | |
4901 | 4896 | | |
4902 | 4897 | | |
4903 | 4898 | | |
| |||
0 commit comments