* [PATCH] cgroup: Check task_lock in task_subsys_state()
@ 2010-04-23 2:35 Li Zefan
2010-04-23 3:00 ` Matt Helsley
2010-04-23 4:10 ` Paul E. McKenney
0 siblings, 2 replies; 3+ messages in thread
From: Li Zefan @ 2010-04-23 2:35 UTC (permalink / raw)
To: Paul E. McKenney
Cc: Peter Zijlstra, Lai JIangshan, Paul Menage, Matt Helsley,
Cedric Le Goater, LKML, containers@lists.osdl.org, Andrew Morton
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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] cgroup: Check task_lock in task_subsys_state()
2010-04-23 2:35 [PATCH] cgroup: Check task_lock in task_subsys_state() Li Zefan
@ 2010-04-23 3:00 ` Matt Helsley
2010-04-23 4:10 ` Paul E. McKenney
1 sibling, 0 replies; 3+ messages in thread
From: Matt Helsley @ 2010-04-23 3:00 UTC (permalink / raw)
To: Li Zefan
Cc: Paul E. McKenney, Peter Zijlstra, Lai JIangshan, Paul Menage,
Matt Helsley, Cedric Le Goater, LKML, containers@lists.osdl.org,
Andrew Morton
On Fri, Apr 23, 2010 at 10:35:52AM +0800, Li Zefan wrote:
> 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>
Acked-by: Matt Helsley <matthltc@us.ibm.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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] cgroup: Check task_lock in task_subsys_state()
2010-04-23 2:35 [PATCH] cgroup: Check task_lock in task_subsys_state() Li Zefan
2010-04-23 3:00 ` Matt Helsley
@ 2010-04-23 4:10 ` Paul E. McKenney
1 sibling, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2010-04-23 4:10 UTC (permalink / raw)
To: Li Zefan
Cc: Peter Zijlstra, Lai JIangshan, Paul Menage, Matt Helsley,
Cedric Le Goater, LKML, containers@lists.osdl.org, Andrew Morton
On Fri, Apr 23, 2010 at 10:35:52AM +0800, Li Zefan wrote:
> 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
This is for the maintainers to decide, either way works from my viewpoint.
I have queued it as is with Matt's Acked-by, and am testing it. Thank you!!!
Thanx, Paul
> ---
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-04-23 4:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-23 2:35 [PATCH] cgroup: Check task_lock in task_subsys_state() Li Zefan
2010-04-23 3:00 ` Matt Helsley
2010-04-23 4:10 ` Paul E. McKenney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox