[PATCH 07/16] debug_vm_pgtable/THP: Mark the pte entry huge before using set_pud_at
Anshuman Khandual
anshuman.khandual at arm.com
Wed Aug 12 21:49:34 AEST 2020
On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote:
> kernel expect entries to be marked huge before we use set_pud_at().
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar at linux.ibm.com>
> ---
> mm/debug_vm_pgtable.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c
> index b6aca2526e01..cd609a212dd4 100644
> --- a/mm/debug_vm_pgtable.c
> +++ b/mm/debug_vm_pgtable.c
> @@ -265,7 +265,7 @@ static void __init pud_advanced_tests(struct mm_struct *mm,
> unsigned long pfn, unsigned long vaddr,
> pgprot_t prot)
> {
> - pud_t pud = pfn_pud(pfn, prot);
> + pud_t pud;
>
> if (!has_transparent_hugepage())
> return;
> @@ -274,25 +274,28 @@ static void __init pud_advanced_tests(struct mm_struct *mm,
> /* Align the address wrt HPAGE_PUD_SIZE */
> vaddr = (vaddr & HPAGE_PUD_MASK) + HPAGE_PUD_SIZE;
>
> + pud = pud_mkhuge(pfn_pud(pfn, prot));
> set_pud_at(mm, vaddr, pudp, pud);
> pudp_set_wrprotect(mm, vaddr, pudp);
> pud = READ_ONCE(*pudp);
> WARN_ON(pud_write(pud));
>
> #ifndef __PAGETABLE_PMD_FOLDED
> - pud = pfn_pud(pfn, prot);
> +
> + pud = pud_mkhuge(pfn_pud(pfn, prot));
> set_pud_at(mm, vaddr, pudp, pud);
> pudp_huge_get_and_clear(mm, vaddr, pudp);
> pud = READ_ONCE(*pudp);
> WARN_ON(!pud_none(pud));
>
> - pud = pfn_pud(pfn, prot);
> + pud = pud_mkhuge(pfn_pud(pfn, prot));
> set_pud_at(mm, vaddr, pudp, pud);
> pudp_huge_get_and_clear_full(mm, vaddr, pudp, 1);
> pud = READ_ONCE(*pudp);
> WARN_ON(!pud_none(pud));
> #endif /* __PAGETABLE_PMD_FOLDED */
> - pud = pfn_pud(pfn, prot);
> +
> + pud = pud_mkhuge(pfn_pud(pfn, prot));
> pud = pud_wrprotect(pud);
> pud = pud_mkclean(pud);
> set_pud_at(mm, vaddr, pudp, pud);
>
Looks very similar to the previous patch, hence please fold it back.
Seems fair enough that pxx_set_at() expects given entry to be huge.
But would need to run them across enabled platforms to be sure.
More information about the Linuxppc-dev
mailing list