Skip to content

Commit ae28f17

Browse files
kvaneeshmpe
authored andcommitted
powerpc/mm/book3s: Check for pmd_large instead of pmd_trans_huge
Update few code paths to check for pmd_large. set_pmd_at: We want to use this to store swap pte at pmd level. For swap ptes we don't want to set H_PAGE_THP_HUGE. Hence check for pmd_large in set_pmd_at. This remove the false WARN_ON when using this with swap pmd entry. pmd_page: We don't really use them on pmd migration entries. But they can also work with migration entries and we don't differentiate at the pte level. Hence update pmd_page to work with pmd migration entries too __find_linux_pte: lockless page table walk need to handle pmd migration entries. pmd_trans_huge check will return false on them. We don't set thp = 1 for such entries, but update hpage_shift correctly. Without this we will walk pmd migration entries as a pte page pointer which is wrong. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent f1981b5 commit ae28f17

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

arch/powerpc/mm/hugetlbpage.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -837,8 +837,12 @@ pte_t *__find_linux_pte(pgd_t *pgdir, unsigned long ea,
837837
ret_pte = (pte_t *) pmdp;
838838
goto out;
839839
}
840-
841-
if (pmd_huge(pmd)) {
840+
/*
841+
* pmd_large check below will handle the swap pmd pte
842+
* we need to do both the check because they are config
843+
* dependent.
844+
*/
845+
if (pmd_huge(pmd) || pmd_large(pmd)) {
842846
ret_pte = (pte_t *) pmdp;
843847
goto out;
844848
} else if (is_hugepd(__hugepd(pmd_val(pmd))))

arch/powerpc/mm/pgtable-book3s64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr,
7575
*/
7676
WARN_ON(pte_val(pmd_pte(*pmdp)) & _PAGE_PRESENT);
7777
assert_spin_locked(pmd_lockptr(mm, pmdp));
78-
WARN_ON(!(pmd_trans_huge(pmd) || pmd_devmap(pmd)));
78+
WARN_ON(!(pmd_large(pmd) || pmd_devmap(pmd)));
7979
#endif
8080
trace_hugepage_set_pmd(addr, pmd_val(pmd));
8181
return set_pte_at(mm, addr, pmdp_ptep(pmdp), pmd_pte(pmd));

arch/powerpc/mm/pgtable_64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ struct page *pud_page(pud_t pud)
306306
*/
307307
struct page *pmd_page(pmd_t pmd)
308308
{
309-
if (pmd_trans_huge(pmd) || pmd_huge(pmd) || pmd_devmap(pmd))
309+
if (pmd_large(pmd) || pmd_huge(pmd) || pmd_devmap(pmd))
310310
return pte_page(pmd_pte(pmd));
311311
return virt_to_page(pmd_page_vaddr(pmd));
312312
}

0 commit comments

Comments
 (0)