Re: [PATCH] mm-treewide-redefine-max_order-sanely-fix.txt

From: Andrew Morton
Date: Thu Apr 06 2023 - 18:44:29 EST


On Fri, 7 Apr 2023 00:14:31 +0300 Mike Rapoport <rppt@xxxxxxxxxx> wrote:

> > > Shouldn't that be
> > > else
> > > order = 0;
> > > ?
> >
> > +Mike.
> >
> > No. start == 0 is MAX_ORDER-aligned. We want to free the pages in the
> > largest chunks alignment allows.
>
> Right. Before the changes to MAX_ORDER it was
>
> order = min(MAX_ORDER - 1UL, __ffs(start));
>
> which would evaluate to 10.
>
> I'd just prefer the comment to include the explanation about why we choose
> MAX_ORDER for start == 0. Say
>
> /*
> * __ffs() behaviour is undefined for 0 and we want to free the
> * pages in the largest chunks alignment allows, so set order to
> * MAX_ORDER when start == 0
> */

Meanwhile I'd like to fix "various boot failures (hang) on arm targets"
in -next, so I queued up Kirill's informal fix for now.