Re: [PATCH v2] memblock: don't run loop in memblock_add_range() twice

From: Mike Rapoport
Date: Mon Oct 31 2022 - 04:17:10 EST


On Tue, Oct 25, 2022 at 03:09:43PM +0800, Yajun Deng wrote:
> There is no need round twice in memblock_add_range().
>
> We can call memblock_double_array() to extend the size if type->cnt
> greater or equal to type->max before memblock_insert_region(); otherwise,
> we can insert the new region directly.
>
> v2:
> - Add a comment when the allocation is required.
>
> Signed-off-by: Yajun Deng <yajun.deng@xxxxxxxxx>
> ---
> mm/memblock.c | 69 ++++++++++++++++++---------------------------------
> 1 file changed, 24 insertions(+), 45 deletions(-)

Applied, thanks!