From: Mathieu Desnoyers via lttng-dev <lttng-dev@lists.lttng.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: wenyang.linux@foxmail.com, Peter Zijlstra <peterz@infradead.org>,
Karim Yaghmour <karim.yaghmour@opersys.com>,
Oleg Nesterov <oleg@redhat.com>,
linux-kernel@vger.kernel.org,
lttng-dev <lttng-dev@lists.lttng.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mel Gorman <mgorman@techsingularity.net>,
Ingo Molnar <mingo@kernel.org>
Subject: Re: [lttng-dev] [PATCH] coredump debugging: add a tracepoint to report the coredumping
Date: Fri, 23 Feb 2024 11:54:30 -0500 [thread overview]
Message-ID: <c9427e40-10b1-49eb-9baa-dde1364e8fe5@efficios.com> (raw)
In-Reply-To: <20240223092630.49b9d367@gandalf.local.home>
On 2024-02-23 09:26, Steven Rostedt wrote:
> On Mon, 19 Feb 2024 13:01:16 -0500
> Mathieu Desnoyers <mathieu.desnoyers@efficios.com> wrote:
>
>> Between "sched_process_exit" and "sched_process_free", the task can still be
>> observed by a trace analysis looking at sched and signal events: it's a zombie at
>> that stage.
>
> Looking at the history of this tracepoint, it was added in 2008 by commit
> 0a16b60758433 ("tracing, sched: LTTng instrumentation - scheduler").
> Hmm, LLTng? I wonder who the author was?
[ common typo: LLTng -> LTTng ;-) ]
>
> Author: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
>
> :-D
>
> Mathieu, I would say it's your call on where the tracepoint can be located.
> You added it, you own it!
Wow! that's now 16 years ago :)
I've checked with Matthew Khouzam (maintainer of Trace Compass)
which care about this tracepoint, and we have not identified any
significant impact of moving it on its model of the scheduler, other
than slightly changing its timing.
I've also checked quickly in lttng-analyses and have not found
any code that care about its specific placement.
So I would say go ahead and move it earlier in do_exit(), it's
fine by me.
If you are interested in a bit of archeology, "sched_process_free"
originated from my ltt-experimental 0.1.99.13 kernel patch against
2.6.12-rc4-mm2 back in September 2005 (that's 19 years ago). It was
a precursor to the LTTng 0.x kernel patchset.
https://lttng.org/files/ltt-experimental/patch-2.6.12-rc4-mm2-ltt-exp-0.1.99.13.gz
Index: kernel/exit.c
===================================================================
--- a/kernel/exit.c (.../trunk/kernel/linux-2.6.12-rc4-mm2) (revision 41)
+++ b/kernel/exit.c (.../branches/mathieu/linux-2.6.12-rc4-mm2) (revision 41)
@@ -4,6 +4,7 @@
* Copyright (C) 1991, 1992 Linus Torvalds
*/
+#include <linux/ltt/ltt-facility-process.h>
#include <linux/config.h>
#include <linux/mm.h>
#include <linux/slab.h>
@@ -55,6 +56,7 @@ static void __unhash_process(struct task
}
REMOVE_LINKS(p);
+ trace_process_free(p->pid);
}
void release_task(struct task_struct * p)
@@ -832,6 +834,8 @@ fastcall NORET_TYPE void do_exit(long co
}
exit_mm(tsk);
+ trace_process_exit(tsk->pid);
+
exit_sem(tsk);
__exit_files(tsk);
__exit_fs(tsk);
This was a significant improvement over the prior LTT which only
had the equivalent of "sched_process_exit", which caused issues
with the Linux scheduler model in LTTV due to zombie processes.
Here is where it appeared in LTT back in 1999:
http://www.opersys.com/ftp/pub/LTT/TracePackage-0.9.0.tgz
patch-ltt-2.2.13-991118
diff -urN linux/kernel/exit.c linux-2.2.13/kernel/exit.c
--- linux/kernel/exit.c Tue Oct 19 20:14:02 1999
+++ linux-2.2.13/kernel/exit.c Sun Nov 7 23:49:17 1999
@@ -14,6 +14,8 @@
#include <linux/acct.h>
#endif
+#include <linux/trace.h>
+
#include <asm/uaccess.h>
#include <asm/pgtable.h>
#include <asm/mmu_context.h>
@@ -386,6 +388,8 @@
del_timer(&tsk->real_timer);
end_bh_atomic();
+ TRACE_PROCESS(TRACE_EV_PROCESS_EXIT, 0, 0);
+
lock_kernel();
fake_volatile:
#ifdef CONFIG_BSD_PROCESS_ACCT
And it was moved to its current location (after exit_mm()) a bit
later (2001):
http://www.opersys.com/ftp/pub/LTT/TraceToolkit-0.9.5pre2.tgz
Patches/patch-ltt-linux-2.4.5-vanilla-010909-1.10
diff -urN linux/kernel/exit.c /ext2/home/karym/kernel/linux-2.4.5/kernel/exit.c
--- linux/kernel/exit.c Fri May 4 17:44:06 2001
+++ /ext2/home/karym/kernel/linux-2.4.5/kernel/exit.c Wed Jun 20 12:39:24 2001
@@ -14,6 +14,8 @@
#include <linux/acct.h>
#endif
+#include <linux/trace.h>
+
#include <asm/uaccess.h>
#include <asm/pgtable.h>
#include <asm/mmu_context.h>
@@ -439,6 +441,8 @@
#endif
__exit_mm(tsk);
+ TRACE_PROCESS(TRACE_EV_PROCESS_EXIT, 0, 0);
+
lock_kernel();
sem_exit();
__exit_files(tsk);
So this sched_process_exit placement was actually decided
by Karim Yaghmour back in the LTT days (2001). I don't think
he will mind us moving it around some 23 years later. ;)
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
next parent reply other threads:[~2024-02-23 16:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <tencent_5CD40341EC9384E9B7CC127EA5CF2655B408@qq.com>
[not found] ` <20240217104924.GB10393@redhat.com>
[not found] ` <20240219112926.77ac16f8@gandalf.local.home>
[not found] ` <20240219170038.GA710@redhat.com>
[not found] ` <20240219122825.31579a1e@gandalf.local.home>
[not found] ` <776b842b-b19f-44bf-bc34-ac756fce7466@efficios.com>
[not found] ` <20240223092630.49b9d367@gandalf.local.home>
2024-02-23 16:54 ` Mathieu Desnoyers via lttng-dev [this message]
2024-02-23 17:03 ` [lttng-dev] [PATCH] coredump debugging: add a tracepoint to report the coredumping Steven Rostedt via lttng-dev
2024-02-23 17:12 ` Karim Yaghmour via lttng-dev
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=c9427e40-10b1-49eb-9baa-dde1364e8fe5@efficios.com \
--to=lttng-dev@lists.lttng.org \
--cc=karim.yaghmour@opersys.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 \
--cc=wenyang.linux@foxmail.com \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).