Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] The benchmark allocates over 9.1 MB of static arrays in 
`.init.data`, which bloats the kernel image and can cause boot failures on 
memory-constrained architectures.
--

--- Patch [1]: [PATCH v2] lib: test bitmap vs IDA vs Maple Tree performance for 
region allocations ---
commit 3ff59b7f49e8b1a285e39778b952abbfe86e1ed9
Author: Yury Norov <[email protected]>

lib: test bitmap vs IDA vs Maple Tree performance for region allocations

This commit adds a microbenchmark to compare the cost of allocating and
freeing variable-sized regions using a bitmap, IDA, and a Maple Tree. It
processes a randomly generated sequence of region sizes until the configured
capacity is exhausted.

Link: 
https://lore.kernel.org/all/[email protected]/

> diff --git a/lib/region_alloc_benchmark.c b/lib/region_alloc_benchmark.c
> new file mode 100644
> index 0000000000000..46cd0dfe935f6
> --- /dev/null
> +++ b/lib/region_alloc_benchmark.c
> @@ -0,0 +1,174 @@
[ ... ]
> +#define MAP_SIZE     (1000000UL)
> +#define REGION_MAX_SIZE      32
> +
> +static DECLARE_BITMAP(alloc_bitmap, MAP_SIZE) __initdata;
> +/* One more request guarantees that even an all-ones trace reaches ENOSPC. */
> +static u8 region_sizes[MAP_SIZE + 1] __initdata;
> +static unsigned long region_indexes[MAP_SIZE] __initdata;

[Severity: Medium]
Is it safe to allocate over 9.1 MB of static arrays in .init.data here?

This inflates the uncompressed kernel image size and can cause build failures
like relocation truncation or boot failures on memory-constrained architectures,
especially when built-in via allmodconfig.

Could these large benchmark buffers be dynamically allocated at runtime using
kvmalloc_array() or vmalloc() instead?

-- 
Sashiko AI review · 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to