Skip to content

Commit ad500fb

Browse files
Peng Zhangrppt
authored andcommitted
memblock: Make a boundary tighter in memblock_add_range().
When type->cnt * 2 + 1 is less than or equal to type->max, there is enough empty regions to insert. Signed-off-by: Peng Zhang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mike Rapoport (IBM) <[email protected]>
1 parent 6d796c5 commit ad500fb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mm/memblock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,11 +601,11 @@ static int __init_memblock memblock_add_range(struct memblock_type *type,
601601
/*
602602
* The worst case is when new range overlaps all existing regions,
603603
* then we'll need type->cnt + 1 empty regions in @type. So if
604-
* type->cnt * 2 + 1 is less than type->max, we know
604+
* type->cnt * 2 + 1 is less than or equal to type->max, we know
605605
* that there is enough empty regions in @type, and we can insert
606606
* regions directly.
607607
*/
608-
if (type->cnt * 2 + 1 < type->max)
608+
if (type->cnt * 2 + 1 <= type->max)
609609
insert = true;
610610

611611
repeat:

0 commit comments

Comments
 (0)