From: Tony Lu <[email protected]>
Subject: mm/hugetlb: set PTE as huge in hugetlb_change_protection and 
remove_migration_pte

When setting a huge PTE, besides calling pte_mkhuge(), we also need to
call arch_make_huge_pte(), which we indeed do in make_huge_pte(), but we
forget to do in hugetlb_change_protection() and remove_migration_pte().

Signed-off-by: Zhigang Lu <[email protected]>
Signed-off-by: Chris Metcalf <[email protected]>
Reviewed-by: Michal Hocko <[email protected]>
Acked-by: Hillf Danton <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---

 mm/hugetlb.c |    1 +
 mm/migrate.c |    4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff -puN 
mm/hugetlb.c~mm-hugetlb-set-pte-as-huge-in-hugetlb_change_protection-and-remove_migration_pte
 mm/hugetlb.c
--- 
a/mm/hugetlb.c~mm-hugetlb-set-pte-as-huge-in-hugetlb_change_protection-and-remove_migration_pte
+++ a/mm/hugetlb.c
@@ -3033,6 +3033,7 @@ unsigned long hugetlb_change_protection(
                if (!huge_pte_none(huge_ptep_get(ptep))) {
                        pte = huge_ptep_get_and_clear(mm, address, ptep);
                        pte = pte_mkhuge(pte_modify(pte, newprot));
+                       pte = arch_make_huge_pte(pte, vma, NULL, 0);
                        set_huge_pte_at(mm, address, ptep, pte);
                        pages++;
                }
diff -puN 
mm/migrate.c~mm-hugetlb-set-pte-as-huge-in-hugetlb_change_protection-and-remove_migration_pte
 mm/migrate.c
--- 
a/mm/migrate.c~mm-hugetlb-set-pte-as-huge-in-hugetlb_change_protection-and-remove_migration_pte
+++ a/mm/migrate.c
@@ -160,8 +160,10 @@ static int remove_migration_pte(struct p
        if (is_write_migration_entry(entry))
                pte = pte_mkwrite(pte);
 #ifdef CONFIG_HUGETLB_PAGE
-       if (PageHuge(new))
+       if (PageHuge(new)) {
                pte = pte_mkhuge(pte);
+               pte = arch_make_huge_pte(pte, vma, new, 0);
+       }
 #endif
        flush_cache_page(vma, addr, pte_pfn(pte));
        set_pte_at(mm, addr, ptep, pte);
_
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to