Messages in this thread | | | Date | Thu, 14 Oct 2021 10:32:01 -0400 | From | Steven Rostedt <> | Subject | Re: [PATCH] tracing: save cmdline only when task does not exist in savecmd for optimization |
| |
On Mon, 11 Oct 2021 19:50:18 +0800 Yang Jihong <yangjihong1@huawei.com> wrote:
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c > index 7896d30d90f7..a795610a3b37 100644 > --- a/kernel/trace/trace.c > +++ b/kernel/trace/trace.c > @@ -2427,8 +2427,11 @@ static int trace_save_cmdline(struct task_struct *tsk) > savedcmd->cmdline_idx = idx; > } > > - savedcmd->map_cmdline_to_pid[idx] = tsk->pid; > - set_cmdline(idx, tsk->comm); > + /* save cmdline only when task does not exist in savecmd */ > + if (savedcmd->map_cmdline_to_pid[idx] != tsk->pid) { > + savedcmd->map_cmdline_to_pid[idx] = tsk->pid; > + set_cmdline(idx, tsk->comm); > + } >
I now remember why I never did it this way. This breaks saving the command line when we do an exec.
That is, just because mapped_pid == tsk->pid does not mean that the comm is the same.
-- Steve
| |