Re: [PATCH v2 16/22] mm/page_alloc: separate pcplists by freetype flags
From: Vlastimil Babka (SUSE)
Date: Wed May 13 2026 - 04:51:25 EST
On 3/20/26 19:23, Brendan Jackman wrote:
> The normal freelists are already separated by this flag, so now update
> the pcplists accordingly. This follows the most "obvious" design where
> __GFP_UNMAPPED is supported at arbitrary orders.
>
> If necessary, it would be possible to avoid the proliferation of
> pcplists by restricting orders that can be allocated from them with this
> FREETYPE_UNMAPPED.
>
> On the other hand, there's currently no usecase for movable/reclaimable
> unmapped memory, and constraining the migratetype doesn't have any
> tricky plumbing implications. So, take advantage of that and assume that
> FREETYPE_UNMAPPED implies MIGRATE_UNMOVABLE.
>
> Overall, this just takes the existing space of pindices and tacks
> another bank on the end. For !THP this is just 4 more lists, with THP
> there is a single additional list for hugepages.
>
> Signed-off-by: Brendan Jackman <jackmanb@xxxxxxxxxx>
Reviewed-by: Vlastimil Babka (SUSE) <vbabka@xxxxxxxxxx>
Nit:
> ---
> include/linux/mmzone.h | 11 ++++++++++-
> mm/page_alloc.c | 44 +++++++++++++++++++++++++++++++++-----------
> 2 files changed, 43 insertions(+), 12 deletions(-)
>
> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index af662e4912591..65efc08152b0c 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -778,8 +778,17 @@ enum zone_watermarks {
> #else
> #define NR_PCP_THP 0
> #endif
> +/*
> + * FREETYPE_UNMAPPED can currently only be used with MIGRATE_UNMOVABLE, no for
so ^
> + * those there's no need to encode the migratetype in the pindex.
> + */
> +#ifdef CONFIG_PAGE_ALLOC_UNMAPPED
> +#define NR_UNMAPPED_PCP_LISTS (PAGE_ALLOC_COSTLY_ORDER + 1 + !!NR_PCP_THP)
> +#else
> +#define NR_UNMAPPED_PCP_LISTS 0
> +#endif
> #define NR_LOWORDER_PCP_LISTS (MIGRATE_PCPTYPES * (PAGE_ALLOC_COSTLY_ORDER + 1))
> -#define NR_PCP_LISTS (NR_LOWORDER_PCP_LISTS + NR_PCP_THP)
> +#define NR_PCP_LISTS (NR_LOWORDER_PCP_LISTS + NR_PCP_THP + NR_UNMAPPED_PCP_LISTS)
>
> /*
> * Flags used in pcp->flags field.
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index f125eae790f73..53848312a0c21 100644