diff options
author | Peng Zhang <zhangpeng.00@bytedance.com> | 2023-01-29 10:00:33 +0100 |
---|---|---|
committer | Mike Rapoport (IBM) <rppt@kernel.org> | 2023-01-31 14:51:42 +0100 |
commit | ad500fb2d11b3739dcbc17a31976828b9161ecf5 (patch) | |
tree | e3cc000538779250f5d3538583c87d63a1dfc1e6 /mm/memblock.c | |
parent | Linux 6.2-rc6 (diff) | |
download | linux-ad500fb2d11b3739dcbc17a31976828b9161ecf5.tar.xz linux-ad500fb2d11b3739dcbc17a31976828b9161ecf5.zip |
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 <zhangpeng.00@bytedance.com>
Link: https://lore.kernel.org/r/20230129090034.12310-2-zhangpeng.00@bytedance.com
Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
Diffstat (limited to 'mm/memblock.c')
-rw-r--r-- | mm/memblock.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/memblock.c b/mm/memblock.c index 685e30e6d27c..836eb71ea3ea 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -601,11 +601,11 @@ static int __init_memblock memblock_add_range(struct memblock_type *type, /* * 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 + * type->cnt * 2 + 1 is less than or equal to 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) + if (type->cnt * 2 + 1 <= type->max) insert = true; repeat: |