Re: [PATCH 2/2] creds: __task_cred(current) doesn't needrcu_read_lock_held()

From: Oleg Nesterov
Date: Tue Sep 20 2011 - 11:41:16 EST


On 09/20, Serge Hallyn wrote:
>
> Quoting Oleg Nesterov (oleg@xxxxxxxxxx):
> > Change __task_cred(task) to accept "task == current" without
> > rcu_read_lock_held(). This is what current_cred() currently does,
> > and with this change __task_cred() becomes more flexible/usable.
> >
> > Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx>
>
> So to check whether I've got this straight, the original __task_cred()
> was allowing rcu read lock to not be held for a non-running task, but
> required rcu read lock if task was running? With these two patches,
> rcu read lock will not be needed if task == current?

Yes.

> If so, then that sounds good to me, and an unconditional rcu_read_lock()
> at wait_task_zombie() seems better than at send_signal()...

Agreed.

Although sometimes I think it would be better to use rcu_dereference_raw()
with a comment in some places.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/