All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Paul Menage <menage@google.com>, Li Zefan <lizf@cn.fujitsu.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH RESEND] cgroups: fix incorrect using rcu_dereference() in cgroup_subsys_state()
Date: Tue, 4 Jan 2011 13:23:57 -0800	[thread overview]
Message-ID: <20110104212357.GU2026@linux.vnet.ibm.com> (raw)
In-Reply-To: <4D22D7BE.4070702@cn.fujitsu.com>

On Tue, Jan 04, 2011 at 04:18:06PM +0800, Lai Jiangshan wrote:
> From: Li Zefan <lizf@cn.fujitsu.com>
> Date: Mon, 25 Aug 2008 11:05:28 +0800
> (Original) Subject: [PATCH] cgroup: fix wrong rcu_dereference()
> 
> It is tsk->cgroups which is protected by RCU, not ->subsys[subsys_id].
> 
> laijs: updated it(the surrounding code have been changed since these two years).

This looks plausible to me, assuming that the cgroups guys are OK with
it.

One requested change: could you please delete the rcu_read_lock_held()?
This is now implied by rcu_dereference_check().  With that:

Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> ---
> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
> index ed4ba11..a798814 100644
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -535,10 +535,11 @@ static inline struct cgroup_subsys_state *cgroup_subsys_state(
>   * cgroup_subsys::attach() methods.
>   */
>  #define task_subsys_state_check(task, subsys_id, __c)			\
> -	rcu_dereference_check(task->cgroups->subsys[subsys_id],		\
> +	rcu_dereference_check(task->cgroups,				\
>  			      rcu_read_lock_held() ||			\
>  			      lockdep_is_held(&task->alloc_lock) ||	\
> -			      cgroup_lock_is_held() || (__c))
> +			      cgroup_lock_is_held() ||			\
> +			      (__c))->subsys[subsys_id]
> 
>  static inline struct cgroup_subsys_state *
>  task_subsys_state(struct task_struct *task, int subsys_id)

  reply	other threads:[~2011-01-04 21:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-04  8:18 [PATCH RESEND] cgroups: fix incorrect using rcu_dereference() in cgroup_subsys_state() Lai Jiangshan
2011-01-04 21:23 ` Paul E. McKenney [this message]
2011-01-05  1:31 ` Paul Menage

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110104212357.GU2026@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=menage@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.