Re: [PATCH v6 15/16] rv: Add deadline monitors

From: Gabriele Monaco

Date: Mon Mar 02 2026 - 10:16:45 EST


On Mon, 2026-03-02 at 15:37 +0100, Juri Lelli wrote:
> > + if (!pid)
> > + *p = current;
> > + else {
> > + /*
> > + * Required for find_task_by_vpid, make sure the caller
> > doesn't
> > + * need to get_task_struct().
> > + */
> > + guard(rcu)();
> > + *p = find_task_by_vpid(pid);
> > + if (unlikely(!*p))
> > + return -EINVAL;
> > + }
>
> Not sure I get this comment. RCU is released when the function returns,
> but then the task pointer is dereferenced by callers?

The idea was that the caller should ensure there's no need to do
get_task_struct() (which is fine within the syscall, I'm assuming).

But looking at it again, that's not even necessary as long as the caller locked
RCU, which they should do instead of guarding here.

So yeah, the comment is misleading and I should just do:

guard(rcu)();
extract_params(...);

Thanks for the observation,
Gabriele