Re: [PATCH] mm/page_alloc: change all pageblocks migrate type on coalescing

From: Johannes Weiner

Date: Sun Dec 14 2025 - 11:06:12 EST


On Fri, Dec 12, 2025 at 04:46:46PM +0100, Vlastimil Babka wrote:
> On 12/12/25 16:14, Alexander Gordeev wrote:
> > When a page is freed it coalesces with a buddy into a higher
> > order page while possible. When the buddy page migrate type
> > differs, it is expected to be updated to match the one of the
> > page being freed.
> >
> > However, only the first pageblock of the buddy page is updated,
> > while the rest of the pageblocks are left unchanged.
> >
> > That causes warnings in later expand() and other code paths
> > (like below), since an inconsistency between migration type
> > of the list containing the page and the page-owned pageblocks
> > migration types is introduced.

Absolutely right, and the fix makes sense to me. Thanks!

> Hm I guess we haven't seen this before because it's common that
> pageblock_order is just one below MAX_ORDER so we're only merging two
> pageblocks. But your arch/config must be different to expose it. In any case
> LGTM, thanks.

+1

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

Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx>

The warning makes the issue loud, but your patch is arguably fixing an
earlier commit that introduces type updates during merges. How about:

Fixes: e6cf9e1c4cde ("mm: page_alloc: fix up block types when merging compatible blocks")
Cc: stable@xxxxxxxxxx