mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
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>
This commit is contained in:
committed by
Mike Rapoport (IBM)
parent
6d796c50f8
commit
ad500fb2d1
@@ -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,
|
* The worst case is when new range overlaps all existing regions,
|
||||||
* then we'll need type->cnt + 1 empty regions in @type. So if
|
* 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
|
* that there is enough empty regions in @type, and we can insert
|
||||||
* regions directly.
|
* regions directly.
|
||||||
*/
|
*/
|
||||||
if (type->cnt * 2 + 1 < type->max)
|
if (type->cnt * 2 + 1 <= type->max)
|
||||||
insert = true;
|
insert = true;
|
||||||
|
|
||||||
repeat:
|
repeat:
|
||||||
|
Reference in New Issue
Block a user