Re: [patch V3 06/18] posix-timers: Remove SLAB_PANIC from kmem cache

From: Alexey Dobriyan
Date: Mon Mar 10 2025 - 02:50:55 EST


> - posix_timers_cache = kmem_cache_create("posix_timers_cache",
> - sizeof(struct k_itimer), 0,
> - SLAB_PANIC | SLAB_ACCOUNT, NULL);
> + posix_timers_cache = kmem_cache_create("posix_timers_cache", sizeof(struct k_itimer), 0,
> + SLAB_ACCOUNT, NULL);

> There is no need to panic when the posix-timer kmem_cache can't be
> created. timer_create() will fail with -ENOMEM and that's it.

Of course there is a reason to panic.

Where did the memory go, so there is not enough for a tiny
"kmem_cache" instance?

You've taken the branch from __init code which is discarded
and made it a branch which can not be.

More or less every __init allocation should panic not the other way
around.