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

Lorenzo Stoakes
2025-11-21T19:25:37Z

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@oracle.com>
>
> Yeah much better.

Thanks! :)

>
> Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
>

Cheers! :)