2023-09-14 10:23:03

by Mel Gorman

[permalink] [raw]
Subject: Re: [PATCH 2/6] mm: page_alloc: fix up block types when merging compatible blocks

On Mon, Sep 11, 2023 at 03:41:43PM -0400, Johannes Weiner wrote:
> The buddy allocator coalesces compatible blocks during freeing, but it
> doesn't update the types of the subblocks to match. When an allocation
> later breaks the chunk down again, its pieces will be put on freelists
> of the wrong type. This encourages incompatible page mixing (ask for
> one type, get another), and thus long-term fragmentation.
>
> Update the subblocks when merging a larger chunk, such that a later
> expand() will maintain freelist type hygiene.
>
> v2:
> - remove spurious change_pageblock_range() move (Zi Yan)
>
> Signed-off-by: Johannes Weiner <[email protected]>

I'm not 100% convinced on the amount of harm this causes but given that
it's a relatively rare condition, I didn't think about the consequences
too deeply. The patch certainly has merit so;

Acked-by: Mel Gorman <[email protected]>

--
Mel Gorman
SUSE Labs