Re: [PATCH 4/4] mm/page_alloc: remove ifdefs from pindex helpers

From: Vlastimil Babka (SUSE)

Date: Fri May 15 2026 - 11:30:20 EST


On 5/15/26 15:15, Brendan Jackman wrote:
> On Wed May 13, 2026 at 5:19 PM UTC, Vlastimil Babka (SUSE) wrote:
>> On 5/13/26 14:35, Brendan Jackman wrote:
>>
>> Uh yeah, VM_BUG_ONs are frowned upon now. But doing a VM_WARN_ON_ONCE here
>> makes little sense. There's no safe fallback if we end up here with a wrong
>> value.
>
> Isn't that grounds for upgrading them to a real BUG then? My experience

If Linus noticed, there would be yelling :)

> has been (I broke this code lots of times lol, I REALLY struggle with
> this arithmetic stuff) if something goes wrong here the machine quickly
> gets irrevocably and undebuggably borked. Crashing is the best case
> scenario.

Yeah it will crash quickly anyway if you mess it up. I guess if the check
would help you find more quickly what you messed up, a VM_WARN_ON_ONCE would
still have some value even if it can't avoid the imminent disaster. So maybe
just switch it to that.

>> And it's all internal to page alloc so I'd just drop those checks
>> completely at this point.
>
> But, I won't die on the above hill, if people really hate BUG that much
> happy to go with the flow.
>
> In that case, I'd suggest we drop them as a separate patch.