Re: [PATCH] mm/page_vma_mapped: guard check_pmd() with CONFIG_TRANSPARENT_HUGEPAGE
From: Andrew Morton
Date: Wed Sep 02 2026 - 23:02:26 EST
On Wed, 24 Jun 2026 08:23:59 +0000 Wei Yang <richard.weiyang@xxxxxxxxx> wrote:
> The kernel test robot reported a build failure on the parisc architecture
> when expanding HPAGE_PMD_NR in check_pmd().
>
> mm/page_vma_mapped.c:142:13: note: in expansion of macro 'HPAGE_PMD_NR'
> if ((pfn + HPAGE_PMD_NR - 1) < pvmw->pfn)
> ^~~~~~~~~~~~
>
> The config [1] in report link shows neither TRANSPARENT_HUGEPAGE nor
> HUGETLB_PAGE is defined. Then trigger the BUILD_BUG.
>
> Fix it by define check_pmd() under CONFIG_TRANSPARENT_HUGEPAGE.
>
> [1]: https://download.01.org/0day-ci/archive/20260624/202606240042.ffPsEXVc-lkp@xxxxxxxxx/config
>
> Fixes: 2aff7a4755be ("mm: Convert page_vma_mapped_walk to work on PFNs")
> Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx>
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Closes: https://lore.kernel.org/oe-kbuild-all/202606240042.ffPsEXVc-lkp@xxxxxxxxx/
>
> ...
>
> --- a/mm/page_vma_mapped.c
> +++ b/mm/page_vma_mapped.c
> @@ -136,6 +136,7 @@ static bool check_pte(struct page_vma_mapped_walk *pvmw, unsigned long pte_nr)
> return true;
> }
>
> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
> /* Returns true if the two ranges overlap. Careful to not overflow. */
> static bool check_pmd(unsigned long pfn, struct page_vma_mapped_walk *pvmw)
> {
> @@ -145,6 +146,12 @@ static bool check_pmd(unsigned long pfn, struct page_vma_mapped_walk *pvmw)
> return false;
> return true;
> }
> +#else
> +static bool check_pmd(unsigned long pfn, struct page_vma_mapped_walk *pvmw)
> +{
> + return false;
> +}
> +#endif
>
> static void step_forward(struct page_vma_mapped_walk *pvmw, unsigned long size)
> {
lgtm, thanks.
You provoked Sashiko into talking about memory corruption and kernel
panics in page_vma_mapped.c. Usual stuff.
https://sashiko.dev/#/patchset/20260624082359.2869-1-richard.weiyang@xxxxxxxxx
I'll cc likely suspects but boy do we need a way of being more
organized about this.