Re: [PATCH] mm: Replace READ_ONCE() in pud_trans_unstable()

From: Lorenzo Stoakes

Date: Mon Mar 02 2026 - 07:21:36 EST


On Fri, Feb 27, 2026 at 04:03:00AM +0000, Anshuman Khandual wrote:
> Replace READ_ONCE() with the existing standard page table accessor for PUD
> aka pudp_get() in pud_trans_unstable(). This does not create any functional
> change for platforms that do not override pudp_get(), which still defaults
> to READ_ONCE().
>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: David Hildenbrand <david@xxxxxxxxxx>
> Cc: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
> Cc: Mike Rapoport <rppt@xxxxxxxxxx>
> Cc: linux-mm@xxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Signed-off-by: Anshuman Khandual <anshuman.khandual@xxxxxxx>

LGTM so:

Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>

> ---
> This patch applies both on v7.0-rc1 and mm-unstable.
>
> Part of the D128 series but independent. Hence could be considered on its own.
>
> https://lore.kernel.org/all/20260224051153.3150613-4-anshuman.khandual@xxxxxxx/
>
> include/linux/pgtable.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
> index a50df42a893f..d4826447bc93 100644
> --- a/include/linux/pgtable.h
> +++ b/include/linux/pgtable.h
> @@ -1989,7 +1989,7 @@ static inline int pud_trans_unstable(pud_t *pud)
> {
> #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && \
> defined(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD)
> - pud_t pudval = READ_ONCE(*pud);
> + pud_t pudval = pudp_get(pud);
>
> if (pud_none(pudval) || pud_trans_huge(pudval))
> return 1;
> --
> 2.30.2
>