* [PATCH] cgroups: fix lockdep subclasses overflow
@ 2009-02-04 9:11 Li Zefan
2009-02-04 9:15 ` Li Zefan
2009-02-04 15:48 ` Paul Menage
0 siblings, 2 replies; 3+ messages in thread
From: Li Zefan @ 2009-02-04 9:11 UTC (permalink / raw)
To: Andrew Morton; +Cc: Paul Menage, LKML, Linux Containers
I enabled all cgroup subsystems when compiling kernel, and then:
# mount -t cgroup -o net_cls xxx /mnt
# mkdir /mnt/0
This showed up immediately:
BUG: MAX_LOCKDEP_SUBCLASSES too low!
turning off the locking correctness validator.
It's caused by the cgroup hierarchy lock:
for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
struct cgroup_subsys *ss = subsys[i];
if (ss->root == root)
mutex_lock_nested(&ss->hierarchy_mutex, i);
}
Now we have 9 cgroup subsystems, and the above 'i' for net_cls is 9, but
MAX_LOCKDEP_SUBCLASSES is 8.
This patch uses different lockdep keys for different subsystems.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
include/linux/cgroup.h | 1 +
kernel/cgroup.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index e4e8e11..499900d 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -378,6 +378,7 @@ struct cgroup_subsys {
* - initiating hotplug events
*/
struct mutex hierarchy_mutex;
+ struct lock_class_key subsys_key;
/*
* Link to parent, and list entry in parent's children.
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 5a54ff4..e14db9c 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -2351,7 +2351,7 @@ static void cgroup_lock_hierarchy(struct cgroupfs_root *root)
for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
struct cgroup_subsys *ss = subsys[i];
if (ss->root == root)
- mutex_lock_nested(&ss->hierarchy_mutex, i);
+ mutex_lock(&ss->hierarchy_mutex);
}
}
@@ -2637,6 +2637,7 @@ static void __init cgroup_init_subsys(struct cgroup_subsys *ss)
BUG_ON(!list_empty(&init_task.tasks));
mutex_init(&ss->hierarchy_mutex);
+ lockdep_set_class(&ss->hierarchy_mutex, &ss->subsys_key);
ss->active = 1;
}
--
1.5.4.rc3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] cgroups: fix lockdep subclasses overflow
2009-02-04 9:11 [PATCH] cgroups: fix lockdep subclasses overflow Li Zefan
@ 2009-02-04 9:15 ` Li Zefan
2009-02-04 15:48 ` Paul Menage
1 sibling, 0 replies; 3+ messages in thread
From: Li Zefan @ 2009-02-04 9:15 UTC (permalink / raw)
To: Andrew Morton; +Cc: Paul Menage, LKML, Linux Containers
Li Zefan wrote:
> I enabled all cgroup subsystems when compiling kernel, and then:
> # mount -t cgroup -o net_cls xxx /mnt
> # mkdir /mnt/0
>
> This showed up immediately:
> BUG: MAX_LOCKDEP_SUBCLASSES too low!
> turning off the locking correctness validator.
>
> It's caused by the cgroup hierarchy lock:
> for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
> struct cgroup_subsys *ss = subsys[i];
> if (ss->root == root)
> mutex_lock_nested(&ss->hierarchy_mutex, i);
> }
>
> Now we have 9 cgroup subsystems, and the above 'i' for net_cls is 9, but
sorry, a typo here: the above 'i' for net_cls is 8.
> MAX_LOCKDEP_SUBCLASSES is 8.
>
> This patch uses different lockdep keys for different subsystems.
>
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
> ---
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cgroups: fix lockdep subclasses overflow
2009-02-04 9:11 [PATCH] cgroups: fix lockdep subclasses overflow Li Zefan
2009-02-04 9:15 ` Li Zefan
@ 2009-02-04 15:48 ` Paul Menage
1 sibling, 0 replies; 3+ messages in thread
From: Paul Menage @ 2009-02-04 15:48 UTC (permalink / raw)
To: Li Zefan; +Cc: Andrew Morton, LKML, Linux Containers
On Wed, Feb 4, 2009 at 1:11 AM, Li Zefan <lizf@cn.fujitsu.com> wrote:
>
> This patch uses different lockdep keys for different subsystems.
>
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Paul Menage <menage@google.com>
Looks good, thanks.
Paul
> ---
> include/linux/cgroup.h | 1 +
> kernel/cgroup.c | 3 ++-
> 2 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
> index e4e8e11..499900d 100644
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -378,6 +378,7 @@ struct cgroup_subsys {
> * - initiating hotplug events
> */
> struct mutex hierarchy_mutex;
> + struct lock_class_key subsys_key;
>
> /*
> * Link to parent, and list entry in parent's children.
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index 5a54ff4..e14db9c 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -2351,7 +2351,7 @@ static void cgroup_lock_hierarchy(struct cgroupfs_root *root)
> for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
> struct cgroup_subsys *ss = subsys[i];
> if (ss->root == root)
> - mutex_lock_nested(&ss->hierarchy_mutex, i);
> + mutex_lock(&ss->hierarchy_mutex);
> }
> }
>
> @@ -2637,6 +2637,7 @@ static void __init cgroup_init_subsys(struct cgroup_subsys *ss)
> BUG_ON(!list_empty(&init_task.tasks));
>
> mutex_init(&ss->hierarchy_mutex);
> + lockdep_set_class(&ss->hierarchy_mutex, &ss->subsys_key);
> ss->active = 1;
> }
>
> --
> 1.5.4.rc3
>
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-02-04 15:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-04 9:11 [PATCH] cgroups: fix lockdep subclasses overflow Li Zefan
2009-02-04 9:15 ` Li Zefan
2009-02-04 15:48 ` Paul Menage
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox