From: Wen Yang <wenyang.linux@foxmail.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Mel Gorman <mgorman@techsingularity.net>,
Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] coredump debugging: add a tracepoint to report the coredumping
Date: Sun, 18 Feb 2024 23:16:27 +0800 [thread overview]
Message-ID: <tencent_6EFB821C2775D38F99EBFC6C9F7FAB82A809@qq.com> (raw)
In-Reply-To: <20240217104924.GB10393@redhat.com>
On 2024/2/17 18:49, Oleg Nesterov wrote:
> On 02/17, wenyang.linux@foxmail.com wrote:
>> From: Wen Yang <wenyang.linux@foxmail.com>
>>
>> Currently coredump_task_exit() takes some time to wait for the generation
>> of the dump file. But if the user-space wants to receive a notification
>> as soon as possible it maybe inconvenient.
>>
>> Add the new trace_sched_process_coredump() into coredump_task_exit(),
>> this way a user-space monitor could easily wait for the exits and
>> potentially make some preparations in advance.
> Can't comment, I never know when the new tracepoint will make sense.
>
> Stupid question.
> Oleg.
Thanks for your help.
trace_sched_process_exit() is located after the PF_EXITING flag is set,
so it could not be moved to there.
Could we make the following modifications?
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index dbb01b4b7451..53e9420540dc 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -334,6 +334,13 @@ DEFINE_EVENT(sched_process_template,
sched_process_exit,
TP_PROTO(struct task_struct *p),
TP_ARGS(p));
+/*
+ * Tracepoint for killing a task by a signal:
+ */
+DEFINE_EVENT(sched_process_template, sched_process_kill,
+ TP_PROTO(struct task_struct *p),
+ TP_ARGS(p));
+
/*
* Tracepoint for waiting on task to unschedule:
*/
diff --git a/kernel/signal.c b/kernel/signal.c
index 9b40109f0c56..571342799824 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2866,6 +2866,7 @@ bool get_signal(struct ksignal *ksig)
* Anything else is fatal, maybe with a core dump.
*/
current->flags |= PF_SIGNALED;
+ trace_sched_process_kill(current);
if (sig_kernel_coredump(signr)) {
if (print_fatal_signals)
--
Best wishes,
Wen
>
>> Signed-off-by: Wen Yang <wenyang.linux@foxmail.com>
>> Cc: Oleg Nesterov <oleg@redhat.com>
>> Cc: Steven Rostedt <rostedt@goodmis.org>
>> Cc: Masami Hiramatsu <mhiramat@kernel.org>
>> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>> Cc: Ingo Molnar <mingo@kernel.org>
>> Cc: Mel Gorman <mgorman@techsingularity.net>
>> Cc: Peter Zijlstra <peterz@infradead.org>
>> Cc: linux-kernel@vger.kernel.org
>> ---
>> include/trace/events/sched.h | 7 +++++++
>> kernel/exit.c | 1 +
>> 2 files changed, 8 insertions(+)
>>
>> diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
>> index dbb01b4b7451..ce7448065986 100644
>> --- a/include/trace/events/sched.h
>> +++ b/include/trace/events/sched.h
>> @@ -334,6 +334,13 @@ DEFINE_EVENT(sched_process_template, sched_process_exit,
>> TP_PROTO(struct task_struct *p),
>> TP_ARGS(p));
>>
>> +/*
>> + * Tracepoint for a task coredumping:
>> + */
>> +DEFINE_EVENT(sched_process_template, sched_process_coredump,
>> + TP_PROTO(struct task_struct *p),
>> + TP_ARGS(p));
>> +
>> /*
>> * Tracepoint for waiting on task to unschedule:
>> */
>> diff --git a/kernel/exit.c b/kernel/exit.c
>> index 493647fd7c07..c11e12d73f4e 100644
>> --- a/kernel/exit.c
>> +++ b/kernel/exit.c
>> @@ -425,6 +425,7 @@ static void coredump_task_exit(struct task_struct *tsk)
>> self.next = xchg(&core_state->dumper.next, &self);
>> else
>> self.task = NULL;
>> + trace_sched_process_coredump(tsk);
>> /*
>> * Implies mb(), the result of xchg() must be visible
>> * to core_state->dumper.
>> --
>> 2.25.1
>>
next prev parent reply other threads:[~2024-02-18 15:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-16 18:59 wenyang.linux
2024-02-17 10:49 ` Oleg Nesterov
2024-02-18 15:16 ` Wen Yang [this message]
2024-02-18 17:52 ` Oleg Nesterov
2024-02-19 16:29 ` Steven Rostedt
2024-02-19 17:00 ` Oleg Nesterov
2024-02-19 17:28 ` Steven Rostedt
2024-02-19 18:01 ` Mathieu Desnoyers
2024-02-20 15:08 ` Steven Rostedt
2024-02-23 14:26 ` Steven Rostedt
2024-02-23 16:54 ` Mathieu Desnoyers
2024-02-23 17:03 ` Steven Rostedt
2024-02-23 17:12 ` Karim Yaghmour
2024-02-21 16:00 ` Wen Yang
2024-02-21 17:54 ` Steven Rostedt
2024-02-21 15:45 ` Wen Yang
2024-02-21 17:48 ` Steven Rostedt
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=tencent_6EFB821C2775D38F99EBFC6C9F7FAB82A809@qq.com \
--to=wenyang.linux@foxmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mgorman@techsingularity.net \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.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
all inboxes | Powered by JetHome®