* Re: [patch V3 06/18] posix-timers: Remove SLAB_PANIC from kmem cache
@ 2025-03-10 6:50 Alexey Dobriyan
0 siblings, 0 replies; 2+ messages in thread
From: Alexey Dobriyan @ 2025-03-10 6:50 UTC (permalink / raw)
To: Thomas Gleixner
Cc: linux-kernel, Anna-Maria Behnsen, Frederic Weisbecker,
Benjamin Segall, Eric Dumazet, Andrey Vagin, Pavel Tikhomirov,
Peter Zijlstra, Cyrill Gorcunov
> - 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.
^ permalink raw reply [flat|nested] 2+ messages in thread* [patch V3 00/18] posix-timers: Rework the global hash table and provide a sane mechanism for CRIU
@ 2025-03-08 16:48 Thomas Gleixner
2025-03-08 16:48 ` [patch V3 06/18] posix-timers: Remove SLAB_PANIC from kmem cache Thomas Gleixner
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Gleixner @ 2025-03-08 16:48 UTC (permalink / raw)
To: LKML
Cc: Anna-Maria Behnsen, Frederic Weisbecker, Benjamin Segall,
Eric Dumazet, Andrey Vagin, Pavel Tikhomirov, Peter Zijlstra,
Cyrill Gorcunov
This is a follow up on V2 of this work, which can be found here:
https://lore.kernel.org/all/20250224095736.145530367@linutronix.de
It addresses the scalability problem of the posix timer hash and provides a
performant mechanism to restore Posix timers with a given ID along with a
couple of preperatory cleanups and enhancements. More details about
implementation choices are in the change logs and the cover letter of V1:
https://lore.kernel.org/all/20250302185753.311903554@linutronix.de
Changes vs. V2:
- Ensure consistency on timer_create() (new patch) - Frederic
- Pick up the lock_timer() conditional unlock fix (was V2a)
- Use proper defines in selftests
- Pick up review/ack tags
The series survives all posix timer tests and did not show any regressions
so far.
The series is based on:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip timers/core
and is also available from git:
git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git timers/posix
Thanks,
tglx
---
Eric Dumazet (3):
posix-timers: Initialise timer before adding it to the hash table
posix-timers: Add cond_resched() to posix_timer_add() search loop
posix-timers: Make signal_struct:: Next_posix_timer_id an atomic_t
Peter Zijlstra (1):
posix-timers: Make lock_timer() use guard()
Thomas Gleixner (14):
posix-timers: Ensure that timer initialization is fully visible
posix-timers: Cleanup includes
posix-timers: Remove a few paranoid warnings
posix-timers: Remove SLAB_PANIC from kmem cache
posix-timers: Use guards in a few places
posix-timers: Simplify lock/unlock_timer()
posix-timers: Rework timer removal
posix-timers: Improve hash table performance
posix-timers: Switch to jhash32()
posix-timers: Avoid false cacheline sharing
posix-timers: Make per process list RCU safe
posix-timers: Dont iterate /proc/$PID/timers with sighand:: Siglock held
posix-timers: Provide a mechanism to allocate a given timer ID
selftests/timers/posix-timers: Add a test for exact allocation mode
fs/proc/base.c | 48 --
include/linux/cleanup.h | 22 -
include/linux/posix-timers.h | 30 +
include/linux/sched/signal.h | 3
include/uapi/linux/prctl.h | 10
kernel/signal.c | 2
kernel/sys.c | 5
kernel/time/posix-timers.c | 540 +++++++++++++-------------
tools/testing/selftests/timers/posix_timers.c | 66 +++
9 files changed, 418 insertions(+), 308 deletions(-)
^ permalink raw reply [flat|nested] 2+ messages in thread* [patch V3 06/18] posix-timers: Remove SLAB_PANIC from kmem cache
2025-03-08 16:48 [patch V3 00/18] posix-timers: Rework the global hash table and provide a sane mechanism for CRIU Thomas Gleixner
@ 2025-03-08 16:48 ` Thomas Gleixner
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2025-03-08 16:48 UTC (permalink / raw)
To: LKML
Cc: Anna-Maria Behnsen, Frederic Weisbecker, Benjamin Segall,
Eric Dumazet, Andrey Vagin, Pavel Tikhomirov, Peter Zijlstra,
Cyrill Gorcunov
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.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
---
V2: New patch
---
kernel/time/posix-timers.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -243,9 +243,8 @@ static int posix_get_hrtimer_res(clockid
static __init int init_posix_timers(void)
{
- 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);
return 0;
}
__initcall(init_posix_timers);
@@ -371,8 +370,12 @@ static struct pid *good_sigevent(sigeven
static struct k_itimer *alloc_posix_timer(void)
{
- struct k_itimer *tmr = kmem_cache_zalloc(posix_timers_cache, GFP_KERNEL);
+ struct k_itimer *tmr;
+ if (unlikely(!posix_timers_cache))
+ return NULL;
+
+ tmr = kmem_cache_zalloc(posix_timers_cache, GFP_KERNEL);
if (!tmr)
return tmr;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-10 6:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-10 6:50 [patch V3 06/18] posix-timers: Remove SLAB_PANIC from kmem cache Alexey Dobriyan
-- strict thread matches above, loose matches on Subject: below --
2025-03-08 16:48 [patch V3 00/18] posix-timers: Rework the global hash table and provide a sane mechanism for CRIU Thomas Gleixner
2025-03-08 16:48 ` [patch V3 06/18] posix-timers: Remove SLAB_PANIC from kmem cache Thomas Gleixner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®