Skip to contentSkip to conversation

posix-timers: Remove SLAB_PANIC from kmem cache

PATCH Alexey Dobriyan 1 participant 1 message Mar 10, 2025

lore
Share & tools
lore
#0 lore raw
Quoted 8 lines
(quoted diff) +2 -3
-	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.