Re: [PATCH v3 21/26] mm/page_alloc: implement FREETYPE_UNMAPPED allocations

From: Brendan Jackman

Date: Sat Aug 15 2026 - 10:31:01 EST


On Fri Aug 7, 2026 at 1:16 AM BST, Yosry Ahmed wrote:
>> diff --git a/mm/compaction.c b/mm/compaction.c
>> index 67b01af024e17..c9eb3947ffc79 100644
>> --- a/mm/compaction.c
>> +++ b/mm/compaction.c
>> @@ -1393,6 +1393,9 @@ static bool suitable_migration_source(struct compact_control *cc,
>> block_ft = get_pageblock_freetype(page);
>> block_mt = free_to_migratetype(block_ft);
>>
>> + if (freetype_unmapped(get_pageblock_freetype(page)))
>> + return false;
>> +
>> /*
>> * CMA pages can only be taken by ALLOC_CMA requests. For anybody
>> * else, vacating a CMA block consumes free pages the caller
>> @@ -1444,6 +1447,9 @@ static bool suitable_migration_target(struct compact_control *cc,
>> return false;
>> }
>>
>> + if (freetype_unmapped(get_pageblock_freetype(page)))
>> + return false;
>> +
>
> Do we also want to add safety checks in the page migration code? IIUC,
> if we miss a check in the compaction code and try to compact an
> unmapped pageblock the kernel will crash with a #PF in supervisor
> mode.

Shrug, yeah I would certainly be happy with sprinkling some more

if (WARN_ON(freetype_unmapped(...)))
return -1;

here and there. But yeah this feels like a maintainer preference /
philosophy question :D If the machine is gonna crash quite clearly
anyway maybe it's not worth it, I dunno.

>> if (cc->ignore_block_suitable)
>> return true;
>>