From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
Matt Fleming <matt@codeblueprint.co.uk>,
"Eric W. Biederman" <ebiederm@xmission.com>
Subject: [patch V2 1/3] signal: Provide and use exit_task_sighand()
Date: Thu, 11 Mar 2021 14:20:37 +0100 [thread overview]
Message-ID: <20210311141704.101079841@linutronix.de> (raw)
In-Reply-To: 20210311132036.228542540@linutronix.de
To prepare for caching a sigqueue per task, implement a dedicated function
to flush the sigqueue of the exiting task.
No functional change.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
include/linux/signal.h | 1 +
kernel/exit.c | 3 +--
kernel/signal.c | 9 +++++++++
3 files changed, 11 insertions(+), 2 deletions(-)
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -265,6 +265,7 @@ static inline void init_sigpending(struc
}
extern void flush_sigqueue(struct sigpending *queue);
+extern void exit_task_sighand(struct task_struct *tsk);
/* Test if 'sig' is valid signal. Use this instead of testing _NSIG directly */
static inline int valid_signal(unsigned long sig)
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -152,8 +152,7 @@ static void __exit_signal(struct task_st
* Do this under ->siglock, we can race with another thread
* doing sigqueue_free() if we have SIGQUEUE_PREALLOC signals.
*/
- flush_sigqueue(&tsk->pending);
- tsk->sighand = NULL;
+ exit_task_sighand(tsk);
spin_unlock(&sighand->siglock);
__cleanup_sighand(sighand);
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -471,6 +471,15 @@ void flush_sigqueue(struct sigpending *q
}
/*
+ * Called from __exit_signal. Flush tsk->pending and clear tsk->sighand.
+ */
+void exit_task_sighand(struct task_struct *tsk)
+{
+ flush_sigqueue(&tsk->pending);
+ tsk->sighand = NULL;
+}
+
+/*
* Flush all pending signals for this kthread.
*/
void flush_signals(struct task_struct *t)
next prev parent reply other threads:[~2021-03-11 14:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-11 13:20 [patch V2 0/3] signals: Allow caching one sigqueue object per task Thomas Gleixner
2021-03-11 13:20 ` Thomas Gleixner [this message]
2021-03-11 13:20 ` [patch V2 2/3] signal: Hand SIGQUEUE_PREALLOC flag to __sigqueue_alloc() Thomas Gleixner
2021-03-11 13:20 ` [patch V2 3/3] signal: Allow tasks to cache one sigqueue struct Thomas Gleixner
2021-03-12 11:35 ` Sebastian Andrzej Siewior
2021-03-12 16:18 ` Oleg Nesterov
2021-03-12 19:25 ` Thomas Gleixner
2021-03-12 16:11 ` Oleg Nesterov
2021-03-12 19:26 ` Thomas Gleixner
2021-03-12 21:13 ` Thomas Gleixner
2021-03-13 11:17 ` [patch V3 " Thomas Gleixner
2021-03-13 16:49 ` [patch V2 " Oleg Nesterov
2021-03-16 12:36 ` Thomas Gleixner
2021-03-11 21:13 ` [patch V2 0/3] signals: Allow caching one sigqueue object per task Eric W. Biederman
2021-03-12 20:02 ` Thomas Gleixner
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=20210311141704.101079841@linutronix.de \
--to=tglx@linutronix.de \
--cc=bigeasy@linutronix.de \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=ebiederm@xmission.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matt@codeblueprint.co.uk \
--cc=mgorman@suse.de \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).