Messages in this thread |  | From | Matt Fleming <> | Date | Fri, 18 Jul 2025 16:39:01 +0100 | Subject | Re: [PATCH] stackdepot: Make max number of pools boot-time configurable |
| |
On Tue, Jul 15, 2025 at 12:38 AM Andrew Morton <akpm@linux-foundation.org> wrote: > > > Geeze that was all quite the mouthful. Can't we just do this? > > --- a/lib/stackdepot.c~a > +++ a/lib/stackdepot.c > @@ -36,13 +36,11 @@ > #include <linux/memblock.h> > #include <linux/kasan-enabled.h> > > -#define DEPOT_POOLS_CAP 8192 > -/* The pool_index is offset by 1 so the first record does not have a 0 handle. */ > -#define DEPOT_MAX_POOLS \ > - (((1LL << (DEPOT_POOL_INDEX_BITS)) - 1 < DEPOT_POOLS_CAP) ? \ > - (1LL << (DEPOT_POOL_INDEX_BITS)) - 1 : DEPOT_POOLS_CAP) > - > -static unsigned int stack_max_pools = DEPOT_MAX_POOLS; > +/* > + * The pool_index is offset by 1 so the first record does not have a 0 handle. > + */ > +static unsigned int stack_max_pools __read_mostly = > + MIN((1LL << DEPOT_POOL_INDEX_BITS) - 1, 8192); > > static bool stack_depot_disabled; > static bool __stack_depot_early_init_requested __initdata = IS_ENABLED(CONFIG_STACKDEPOT_ALWAYS_INIT); > _ > > (please add this to the next version)
Nice. Will do.
> (but why do we do this min() at all? Why not simply use (1<<DEPOT_POOL_INDEX_BITS)?) > > (shouldn't that 8192 be 8191? Seems oddly inconsistent)
Yeah, I don't have a good answer here. I was hoping Marco or Alexander would chime in.
> If user hits this they're going to tear hair figuring out the actual > limit. So how about "stack_depot_max_pools exceeds %d, using default > of %d".
Good point. Will fix.
|  |