Re: [RESEND PATCH v3] exit: move trace_sched_process_exit earlier in do_exit()

From: Ingo Molnar
Date: Sat Mar 30 2024 - 06:28:40 EST



* wenyang.linux@xxxxxxxxxxx <wenyang.linux@xxxxxxxxxxx> wrote:

> From: Wen Yang <wenyang.linux@xxxxxxxxxxx>
>
> In a safety critical system, when some processes exit abnormally, it
> is hoped that prompt information can be reported to the monitor as
> soon as possible.

If this event is so critical to catch, a probe can be put on do_exit().
This will be superior to your patch, because it will notify about the
event even sooner.

> Commit 2d4bcf886e42 ("exit: Remove profile_task_exit &
> profile_munmap") simplified the code, but also removed
> profile_task_exit(), which may prevent third-party kernel modules
> from detecting process exits timely.

Could you point out an example of such third-party kernel modules, and
why we should care about them?

> Compared to adding an extra tracking point, it is better to move the
> existing trace_sched_process_exit() earlier in do_exit(), since any
> tracer interested in knowing the point where a task is really
> reclaimed is trace_sched_process_free() called from
> delayed_put_task_struct().[1]

I disagree, I think this scheduler tracepoint should be moved even
*later* in the exit sequence, and be combined with
sched_autogroup_exit_task(), so that the scheduler only has a single
exit-notification callback in essence.

Until this is all done cleanly no tree should pick up this change:

NAKed-by: Ingo Molnar <mingo@xxxxxxxxxx>

Thanks,

Ingo