Messages in this thread Patch in this message | | | From | wenyang.linux@foxmail ... | Subject | [PATCH] coredump debugging: add a tracepoint to report the coredumping | Date | Sat, 17 Feb 2024 02:59:47 +0800 |
| |
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.
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
| |