[patch V2 00/17] posix-timers: Rework the global hash table and provide a sane mechanism for CRIU

From: Thomas Gleixner
Date: Sun Mar 02 2025 - 14:36:54 EST


This is a follow up on V1 of this work, which can be found here:

https://lore.kernel.org/all/20250224095736.145530367@xxxxxxxxxxxxx

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.

Changes vs. V1:

- Simplify the timer removal cleanup - PeterZ
- Use guards consistently - PeterZ
- Switch to jhash32()
- Avoid false sharing by reordering struct k_itimer
- Advance the ID counter when restoring
- A few additional cleanups

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 (13):
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: Don't 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 | 530 +++++++++++++-------------
tools/testing/selftests/timers/posix_timers.c | 60 ++
9 files changed, 403 insertions(+), 307 deletions(-)