cpuset: fix RCU lockdep splat in cpuset_print_task_mems_allowed()
authorLi Zefan <lizefan@huawei.com>
Tue, 12 Mar 2013 02:28:39 +0000 (10:28 +0800)
committerTejun Heo <tj@kernel.org>
Tue, 12 Mar 2013 21:25:25 +0000 (14:25 -0700)
Sasha reported a lockdep warning when OOM was triggered. The reason
is cgroup_name() should be called with rcu_read_lock() held.

Reported-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/cpuset.c

index ace5bfcdcb301d250fb122713b1de5f9404d8d42..efbfca7a33e483787a744a1545f3f1d6b100dcbe 100644 (file)
@@ -2599,6 +2599,7 @@ void cpuset_print_task_mems_allowed(struct task_struct *tsk)
 
        struct cgroup *cgrp = task_cs(tsk)->css.cgroup;
 
+       rcu_read_lock();
        spin_lock(&cpuset_buffer_lock);
 
        nodelist_scnprintf(cpuset_nodelist, CPUSET_NODELIST_LEN,
@@ -2607,6 +2608,7 @@ void cpuset_print_task_mems_allowed(struct task_struct *tsk)
               tsk->comm, cgroup_name(cgrp), cpuset_nodelist);
 
        spin_unlock(&cpuset_buffer_lock);
+       rcu_read_unlock();
 }
 
 /*