From: Hillf Danton <hdanton@sina.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-kernel@vger.kernel.org,
"Eric W. Biederman" <ebiederm@xmission.com>,
Ingo Molnar <mingo@redhat.com>, Mel Gorman <mgorman@suse.de>,
Oleg Nesterov <oleg@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Vincent Guittot <vincent.guittot@linaro.org>,
linux-mm@kvack.org,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH v4] signal: Let tasks cache one sigqueue struct.
Date: Fri, 7 Apr 2023 08:03:06 +0800 [thread overview]
Message-ID: <20230407000306.940-1-hdanton@sina.com> (raw)
In-Reply-To: <20230406204721.A6lSYL7A@linutronix.de>
On Thu, 6 Apr 2023 22:47:21 +0200 Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> 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);
> }
next parent reply other threads:[~2023-04-07 0:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230406194004.KP1K6FwO@linutronix.de>
[not found] ` <20230406204721.A6lSYL7A@linutronix.de>
2023-04-07 0:03 ` Hillf Danton [this message]
2023-04-07 3:53 ` Matthew Wilcox
2023-05-24 15:33 ` Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230407000306.940-1-hdanton@sina.com \
--to=hdanton@sina.com \
--cc=bigeasy@linutronix.de \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=vincent.guittot@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox