Skip to content

signals: Allow caching one sigqueue object per task

Thomas Gleixner lkml 2 versions – Applied

Status from this message: The following commit has been merged into the sched/core branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 2 repliesApplied
  2. v23 patches 10 repliesSuperseded

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/2signal: Hand SIGQUEUE_PREALLOC flag to __sigqueue_alloc()kernel/signal.c+7 -100 replies
2/2signal: Allow tasks to cache one sigqueue structinclude/linux/sched.h include/linux/signal.h kernel/exit.c +2 more+43 -24 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchOleg Nesterov
1/2
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [patch V4 0/2] signals: Allow caching one sigqueue object per task

This is a follow up to the V2/V3 submission which can be found here:

https://lore.kernel.org/r/[email protected]

Signal sending requires a kmem cache allocation at the sender side and the receiver hands it back to the kmem cache when consuming the signal.

This works pretty well even for realtime workloads except for the case when the kmem cache allocation has to go into the slow path which is rare but happens.

Preempt-RT carries a patch which allows caching of one sigqueue object per task. The object is not preallocated. It's cached when the task receives a signal. The cache is freed when the task exits.

The memory overhead for a standard distro setup is pretty small. After boot there are less than 10 objects cached in about 1500 tasks. The speedup for sending a signal from a cached sigqueue object is small (~3us) per signal and almost invisible, but for signal heavy workloads it's definitely measurable and for the targeted realtime workloads it's solving a real world latency issue.

Changes vs V2/3:

- Drop the previous wrapper function and explicitly drop the sigqueue cache at the end of __exit_signals() to handle the self reaping case correctly

Thanks,

tglx

---
 include/linux/sched.h  |    1 
 include/linux/signal.h |    1 
 kernel/exit.c          |    1 
 kernel/fork.c          |    1 
 kernel/signal.c        |   55 +++++++++++++++++++++++++++++++++++++++----------
 5 files changed, 48 insertions(+), 11 deletions(-)