Re: [PATCH 06/10] mm: page_alloc: fix freelist movement during block conversion

From: Vlastimil Babka
Date: Mon Apr 08 2024 - 03:24:45 EST


On 4/5/24 6:56 PM, Johannes Weiner wrote:
> Hi Baolin,
> Ouch, sorry about that! I changed that specific part around later
> during development and didn't retest with CMA. I'll be sure to
> re-enable it again in my config.
>
>> After making the following modifications, the regression is gone.
>>
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index ce67dc6777fa..a7cfe65e45c1 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -2139,7 +2139,8 @@ __rmqueue(struct zone *zone, unsigned int order,
>> int migratetype,
>> if (unlikely(!page)) {
>> if (alloc_flags & ALLOC_CMA)
>> page = __rmqueue_cma_fallback(zone, order);
>> - else
>> +
>> + if (!page)
>> page = __rmqueue_fallback(zone, order, migratetype,
>> alloc_flags);
>> }
>>
>> But I am not sure your original change is intentional? IIUC, we still
>> need try fallbacking even though CMA allocation is failed, please
>> correct me if I misunderstand your code. Thanks.
>
> No, this was accidental. I missed that CMA dependency when changing
> things around for the new return type of __rmqueue_fallback(). Your
> fix is good: just because the request qualifies for CMA doesn't mean
> it will succeed from that region. We need the fallback for those.
>
> Andrew, could you please pick up Baolin's change for this patch?
>
> [baolin.wang@xxxxxxxxxxxxxxxxx: fix allocation failures with CONFIG_CMA]
>
> Thanks for debugging this and the fix, Baolin.

Good fix indeed, didn't spot the issue during review. Thanks!