Re: [PATCH] memblock: remove repeat round

From: Mike Rapoport
Date: Wed Oct 26 2022 - 02:05:02 EST


On Tue, Oct 25, 2022 at 03:24:58AM +0000, Yajun Deng wrote:
> October 25, 2022 12:15 AM, "Mike Rapoport" <rppt@xxxxxxxxxx> wrote:
>
> >> @@ -598,22 +597,6 @@ static int __init_memblock memblock_add_range(struct memblock_type *type,
> >> return 0;
> >> }
> >>
> >> - /*
> >> - * The worst case is when new range overlaps all existing regions,
> >> - * then we'll need type->cnt + 1 empty regions in @type. So if
> >> - * type->cnt * 2 + 1 is less than type->max, we know
> >> - * that there is enough empty regions in @type, and we can insert
> >> - * regions directly.
> >> - */
> >> - if (type->cnt * 2 + 1 < type->max)
> >> - insert = true;
> >> -
> >> -repeat:
> >> - /*
> >> - * The following is executed twice. Once with %false @insert and
> >> - * then with %true. The first counts the number of regions needed
> >> - * to accommodate the new area. The second actually inserts them.
> >> - */
> >> base = obase;
> >> nr_new = 0;
> >
> > I believe nr_new variable is no longer needed, is it?
> >
> No, nr_new is needed before memblock_merge_regions() for return.

Why?


--
Sincerely yours,
Mike.