Re: [PATCH v3 08/16] mm/huge_memory: refactor copy_huge_pmd() non-present logic

From: Lorenzo Stoakes

Date: Fri Nov 21 2025 - 14:25:37 EST


On Fri, Nov 21, 2025 at 06:56:57PM +0100, Vlastimil Babka wrote:
> On 11/10/25 23:21, Lorenzo Stoakes wrote:
> > Right now we are inconsistent in our use of thp_migration_supported():
> >
> > static inline bool thp_migration_supported(void)
> > {
> > return IS_ENABLED(CONFIG_ARCH_ENABLE_THP_MIGRATION);
> > }
> >
> > And simply having arbitrary and ugly #ifdef
> > CONFIG_ARCH_ENABLE_THP_MIGRATION blocks in code.
> >
> > This is exhibited in copy_huge_pmd(), which inserts a large #ifdef
> > CONFIG_ARCH_ENABLE_THP_MIGRATION block and an if-branch which is difficult
> > to follow
> >
> > It's difficult to follow the logic of such a large function and the
> > non-present PMD logic is clearly separate as it sits in a giant if-branch.
> >
> > Therefore this patch both separates out the logic and utilises
> > thp_migration_supported().
> >
> > No functional change intended.
> >
> > Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
>
> Yeah much better.

Thanks! :)

>
> Reviewed-by: Vlastimil Babka <vbabka@xxxxxxx>
>

Cheers! :)