On Thu, 6 Apr 2023 22:47:21 +0200 Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> > The sigqueue caching originated in the PREEMPT_RT tree. A few of the > applications, that were ported to Linux, were ported from OS-9. Sending > notifications from one task to another via a signal was a common > communication model there and so the applications are heavy signal > users. Removing the allocation reduces the critical path, avoids locks > and so lowers the maximal latency of the task while sending a signal. This is needed only if slab does not work for you. Why not make it work better instead of peeling slab one more off just to make signal/rt richer? > > --- a/kernel/signal.c > +++ b/kernel/signal.c > @@ -432,7 +432,18 @@ static struct sigqueue * > return NULL; > =20 > if (override_rlimit || likely(sigpending <=3D task_rlimit(t, RLIMIT_SIGPE= > NDING))) { > - q =3D kmem_cache_alloc(sigqueue_cachep, gfp_flags); > + > + if (!sigqueue_flags) { > + struct sighand_struct *sighand =3D t->sighand; > + > + lockdep_assert_held(&sighand->siglock); > + if (sighand->sigqueue_cache) { > + q =3D sighand->sigqueue_cache; > + sighand->sigqueue_cache =3D NULL; > + } > + } > + if (!q) > + q =3D kmem_cache_alloc(sigqueue_cachep, gfp_flags); > } else { > print_dropped_signal(sig); > }