Re: [PATCH v3 6/7] perf: Rename perf_event_exit_task(.child)

From: Peter Zijlstra
Date: Mon Mar 10 2025 - 10:47:37 EST


On Mon, Mar 10, 2025 at 04:38:36PM +0530, Ravi Bangoria wrote:
> Hi Peter,
>
> On 08-Mar-25 1:03 AM, Peter Zijlstra wrote:
> > The task passed to perf_event_exit_task() is not a child, it is
> > current. Fix this confusing naming, since much of the rest of the code
> > also relies on it being current.
> >
> > Specifically, both exec() and exit() callers use it with current as
> > the argument.
>
> ...
>
> > -static void perf_event_exit_task_context(struct task_struct *child, bool exit)
> > +static void perf_event_exit_task_context(struct task_struct *task, bool exit)
> > {
> > - struct perf_event_context *child_ctx, *clone_ctx = NULL;
> > + struct perf_event_context *ctx, *clone_ctx = NULL;
> > struct perf_event *child_event, *next;
> >
> > - WARN_ON_ONCE(child != current);
> > + WARN_ON_ONCE(task != current);
>
> exec() codepath (i.e. copy_process()) passes child pointer, not 'current'.

I am confused, this not a new warning. Also, copy_process() is clone(),
exec() is another code path.