From: Li Zefan <lizf@cn.fujitsu.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Lai JIangshan <laijs@cn.fujitsu.com>,
Paul Menage <menage@google.com>,
Matt Helsley <matthltc@us.ibm.com>,
Cedric Le Goater <clg@fr.ibm.com>,
LKML <linux-kernel@vger.kernel.org>,
"containers@lists.osdl.org" <containers@lists.osdl.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] cgroup: Check task_lock in task_subsys_state()
Date: Fri, 23 Apr 2010 10:35:52 +0800 [thread overview]
Message-ID: <4BD10788.8060006@cn.fujitsu.com> (raw)
task_subsys_state() is safe under task_lock(). See
Documentation/cgroups/cgroups.txt for locking rule.
This fixes an RCU warning when resume from suspend. The
warning comes from freezer cgroup in cgroup_freezing_or_frozen().
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
I'm not sure which is preferable - access ->alloc_lock directly
like this patch or add task_lock_is_held() in sched.h
---
include/linux/cgroup.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index b8ad1ea..8f78073 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -530,6 +530,7 @@ static inline struct cgroup_subsys_state *task_subsys_state(
{
return rcu_dereference_check(task->cgroups->subsys[subsys_id],
rcu_read_lock_held() ||
+ lockdep_is_held(&task->alloc_lock) ||
cgroup_lock_is_held());
}
--
1.6.3
next reply other threads:[~2010-04-23 2:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-23 2:35 Li Zefan [this message]
2010-04-23 3:00 ` [PATCH] cgroup: Check task_lock in task_subsys_state() Matt Helsley
2010-04-23 4:10 ` Paul E. McKenney
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=4BD10788.8060006@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=clg@fr.ibm.com \
--cc=containers@lists.osdl.org \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matthltc@us.ibm.com \
--cc=menage@google.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox