Re: [PATCH v9 0/6] Make MIGRATE_ISOLATE a standalone bit

From: Zi Yan
Date: Mon Jun 16 2025 - 21:39:10 EST


On 16 Jun 2025, at 21:37, Andrew Morton wrote:

> On Mon, 16 Jun 2025 08:10:13 -0400 Zi Yan <ziy@xxxxxxxxxx> wrote:
>
>> Hi all,
>>
>> This patchset moves MIGRATE_ISOLATE to a standalone bit to avoid
>> being overwritten during pageblock isolation process. Currently,
>> MIGRATE_ISOLATE is part of enum migratetype (in include/linux/mmzone.h),
>> thus, setting a pageblock to MIGRATE_ISOLATE overwrites its original
>> migratetype. This causes pageblock migratetype loss during
>> alloc_contig_range() and memory offline, especially when the process
>> fails due to a failed pageblock isolation and the code tries to undo the
>> finished pageblock isolations.
>>
>> It is on top of mm-everything-2025-06-15-23-48.
>
> mm-new would be a better target. mm-new is not (yet) included in
> linux-next, hence it is not in mm-everything.
>
> I hit a few issues (x86_64 allmodconfig):
>
> In file included from ./include/linux/slab.h:16,
> from ./include/linux/irq.h:21,
> from ./include/linux/of_irq.h:7,
> from drivers/gpu/drm/msm/hdmi/hdmi.c:9:
> ./include/linux/gfp.h:428:25: error: expected identifier before '(' token
> 428 | #define ACR_NONE ((__force acr_flags_t)0) // ordinary allocation request
> | ^
> drivers/gpu/drm/msm/generated/hdmi.xml.h:71:9: note: in expansion of macro 'ACR_NONE'
> 71 | ACR_NONE = 0,
> | ^~~~~~~~
>
>
>
> And this was needed:
>
> kernel/kexec_handover.c uses set_pageblock_migratetype()
>
> --- a/include/linux/page-isolation.h~mm-page_isolation-remove-migratetype-from-move_freepages_block_isolate-fix
> +++ a/include/linux/page-isolation.h
> @@ -45,6 +45,8 @@ void __meminit init_pageblock_migratetyp
> enum migratetype migratetype,
> bool isolate);
>
> +void set_pageblock_migratetype(struct page *page, enum migratetype migratetype);
> +
> bool pageblock_isolate_and_move_free_pages(struct zone *zone, struct page *page);
> bool pageblock_unisolate_and_move_free_pages(struct zone *zone, struct page *page);
>
> --- a/mm/page_alloc.c~mm-page_isolation-remove-migratetype-from-move_freepages_block_isolate-fix
> +++ a/mm/page_alloc.c
> @@ -525,8 +525,7 @@ void clear_pfnblock_bit(const struct pag
> * @page: The page within the block of interest
> * @migratetype: migratetype to set
> */
> -static void set_pageblock_migratetype(struct page *page,
> - enum migratetype migratetype)
> +void set_pageblock_migratetype(struct page *page, enum migratetype migratetype)
> {
> if (unlikely(page_group_by_mobility_disabled &&
> migratetype < MIGRATE_PCPTYPES))
> _

Got it. Let me rebase and resend it.

Best Regards,
Yan, Zi