[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110920150726.GA6234@peqn>
Date: Tue, 20 Sep 2011 10:07:27 -0500
From: Serge Hallyn <serge.hallyn@...onical.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: "Serge E. Hallyn" <serge@...lyn.com>,
Andrew Morton <akpm@...ux-foundation.org>,
David Howells <dhowells@...hat.com>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
lkml <linux-kernel@...r.kernel.org>, richard@....at,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Tejun Heo <tj@...nel.org>
Subject: Re: [PATCH 2/2] creds: __task_cred(current) doesn't need
rcu_read_lock_held()
Quoting Oleg Nesterov (oleg@...hat.com):
> 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@...hat.com>
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?
If so, then that sounds good to me, and an unconditional rcu_read_lock()
at wait_task_zombie() seems better than at send_signal()...
> ---
>
> include/linux/cred.h | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> --- 3.1/include/linux/cred.h~2_task_cred_ck_current 2011-09-20 16:28:47.000000000 +0200
> +++ 3.1/include/linux/cred.h 2011-09-20 16:33:12.000000000 +0200
> @@ -268,8 +268,7 @@ static inline void put_cred(const struct
> * Access the subjective credentials of the current task. RCU-safe,
> * since nobody else can modify it.
> */
> -#define current_cred() \
> - rcu_dereference_protected(current->cred, 1)
> +#define current_cred() __task_cred(current)
>
> /**
> * __task_cred - Access a task's objective credentials
> @@ -284,7 +283,7 @@ static inline void put_cred(const struct
> #define __task_cred(task) \
> ({ \
> const struct task_struct *__t = (task); \
> - rcu_dereference_check(__t->real_cred, 0); \
> + rcu_dereference_check(__t->real_cred, (__t == current));\
> })
>
> /**
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists