Re: [PATCH v3 11/16] mm: introduce pmd_is_huge() and use where appropriate
From: Vlastimil Babka
Date: Thu Nov 27 2025 - 12:00:20 EST
On 11/10/25 23:21, Lorenzo Stoakes wrote:
> The leaf entry PMD case is confusing as only migration entries and
> device private entries are valid at PMD level, not true swap entries.
>
> We repeatedly perform checks of the form is_swap_pmd() || pmd_trans_huge()
> which is itself confusing - it implies that leaf entries at PMD level exist
> and are different from huge entries.
>
> Address this confusion by introduced pmd_is_huge() which checks for either
> case. Sadly due to header dependency issues (huge_mm.h is included very
> early on in headers and cannot really rely on much else) we cannot use
> pmd_is_valid_softleaf() here.
>
> However since these are the only valid, handled cases the function is still
> achieving what it intends to do.
>
> We then replace all instances of is_swap_pmd() || pmd_trans_huge() with
> pmd_is_huge() invocations and adjust logic accordingly to accommodate
> this.
>
> No functional change intended.
>
> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
Reviewed-by: Vlastimil Babka <vbabka@xxxxxxx>