From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id t7d8NtfN2GWUEyoAWB0awg (envelope-from ) for ; Fri, 23 Feb 2024 11:54:47 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=lists.lttng.org header.i=@lists.lttng.org header.a=rsa-sha256 header.s=default header.b=sY/3wXQk; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id CADF61E0D2; Fri, 23 Feb 2024 11:54:47 -0500 (EST) Received: from lists.lttng.org (lists.lttng.org [167.114.26.123]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 9502A1E030 for ; Fri, 23 Feb 2024 11:54:45 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.lttng.org; s=default; t=1708707284; bh=3AFfzK/4VidznFI6nWETWRaF8ph8DRCFtB/R9gf6Um0=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=sY/3wXQkQzLJ0wGfsdcRVAkoQYwrCPpSK4hj7kaiUR3pPDwW+sgY0eRAnGWbO7dtO JzpXxGTgKf3dsHrSUpYleakXoYl57+4LySwC9UfpJFwpA0JqbO+lfZhdqQWYa18kxb obcpQuLqmxIX9ZWMSiSi0tGvEaj3Je1/xq2VvtOwEZ7bjt9ObrC5OTn6IuFfylv7iG KN1yff2Q97MhDCLioN81mWai3HN7zQQbpXxKZtTfaPEI+kpx/CuZWiw4HAES6umv7Z ekoVi0qhY9nmTu55e2LlklGWIHjPa7rmrAQYxC23pokcDbNNe9eRhSBXolPOTeoEB6 4Nq2CxkRDNB3w== Received: from lists-lttng01.efficios.com (localhost [IPv6:::1]) by lists.lttng.org (Postfix) with ESMTP id 4ThGMS514Gz28ML; Fri, 23 Feb 2024 11:54:44 -0500 (EST) Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by lists.lttng.org (Postfix) with ESMTPS id 4ThGMS2CCXz28pw for ; Fri, 23 Feb 2024 11:54:37 -0500 (EST) Received: from [172.16.0.134] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4ThGMB6c12zd2Q; Fri, 23 Feb 2024 11:54:30 -0500 (EST) Message-ID: Date: Fri, 23 Feb 2024 11:54:30 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Steven Rostedt References: <20240217104924.GB10393@redhat.com> <20240219112926.77ac16f8@gandalf.local.home> <20240219170038.GA710@redhat.com> <20240219122825.31579a1e@gandalf.local.home> <776b842b-b19f-44bf-bc34-ac756fce7466@efficios.com> <20240223092630.49b9d367@gandalf.local.home> In-Reply-To: <20240223092630.49b9d367@gandalf.local.home> Subject: Re: [lttng-dev] [PATCH] coredump debugging: add a tracepoint to report the coredumping X-BeenThere: lttng-dev@lists.lttng.org X-Mailman-Version: 2.1.39 Precedence: list List-Id: LTTng development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mathieu Desnoyers via lttng-dev Reply-To: Mathieu Desnoyers Cc: wenyang.linux@foxmail.com, Peter Zijlstra , Karim Yaghmour , Oleg Nesterov , linux-kernel@vger.kernel.org, lttng-dev , Masami Hiramatsu , Mel Gorman , Ingo Molnar Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: lttng-dev-bounces@lists.lttng.org Sender: "lttng-dev" On 2024-02-23 09:26, Steven Rostedt wrote: > On Mon, 19 Feb 2024 13:01:16 -0500 > Mathieu Desnoyers 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 > > :-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 #include #include #include @@ -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 #endif +#include + #include #include #include @@ -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 #endif +#include + #include #include #include @@ -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