[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2084f57b-056c-41db-baf8-65bbc72a66ff@redhat.com>
Date: Fri, 13 Jun 2025 09:34:04 +0200
From: David Hildenbrand <david@...hat.com>
To: Baolin Wang <baolin.wang@...ux.alibaba.com>, akpm@...ux-foundation.org
Cc: lorenzo.stoakes@...cle.com, Liam.Howlett@...cle.com, npache@...hat.com,
ryan.roberts@....com, dev.jain@....com, baohua@...nel.org, shuah@...nel.org,
ziy@...dia.com, linux-mm@...ck.org, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/2] selftests: khugepaged: fix the shmem collapse
failure
On 13.06.25 03:49, Baolin Wang wrote:
> When running the khugepaged selftest for shmem (./khugepaged all:shmem),
> I encountered the following test failures:
> "
> Run test: collapse_full (khugepaged:shmem)
> Collapse multiple fully populated PTE table.... Fail
> ...
> Run test: collapse_single_pte_entry (khugepaged:shmem)
> Collapse PTE table with single PTE entry present.... Fail
> ...
> Run test: collapse_full_of_compound (khugepaged:shmem)
> Allocate huge page... OK
> Split huge page leaving single PTE page table full of compound pages... OK
> Collapse PTE table full of compound pages.... Fail
> "
>
> The reason for the failure is that, it will set MADV_NOHUGEPAGE to prevent
> khugepaged from continuing to scan shmem VMA after khugepaged finishes
> scanning in the wait_for_scan() function. Moreover, shmem requires a refault
> to establish PMD mappings.
>
> However, after commit 2b0f922323cc ("mm: don't install PMD mappings when
> THPs are disabled by the hw/process/vma"), PMD mappings are prevented if the
> VMA is set with MADV_NOHUGEPAGE flag, so shmem cannot establish PMD mappings
> during refault.
>
> One way to fix this issue is to move the MADV_NOHUGEPAGE setting after the
> shmem refault. After shmem refault and check huge, the test case will unmap
> the shmem immediately. So it seems unnecessary to set the MADV_NOHUGEPAGE.
>
> Then we can simply drop the MADV_NOHUGEPAGE setting, and all khugepaged test
> cases passed.
>
> Fixes: 2b0f922323cc ("mm: don't install PMD mappings when THPs are disabled by the hw/process/vma")
> Reviewed-by: Zi Yan <ziy@...dia.com>
> Signed-off-by: Baolin Wang <baolin.wang@...ux.alibaba.com>
> ---
Acked-by: David Hildenbrand <david@...hat.com>
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists