cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] cpuset: fix RCU lockdep splat
@ 2013-01-15  6:10 Li Zefan
       [not found] ` <50F4F2F1.8070107-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Li Zefan @ 2013-01-15  6:10 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Sasha Levin, LKML, Cgroups

Reading /proc/<pid>/cpuset triggered RCU warning, and this bug was
introduced by Commit 5d21cc2db040d01f8c19b8602f6987813e1176b4
("cpuset: replace cgroup_mutex locking with cpuset internal locking")

Here we can retreive tsk->cgroups and call cgroup_path() inside RCU
read section.

Reported-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Li Zefan <lizefan@huawei.com>
---
 kernel/cpuset.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 6aa5bbb..1a675e4 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -2678,15 +2678,15 @@ static int proc_cpuset_show(struct seq_file *m, void *unused_v)
 		goto out_free;
 
 	retval = -EINVAL;
-	mutex_lock(&cpuset_mutex);
+	rcu_read_lock();
 	css = task_subsys_state(tsk, cpuset_subsys_id);
 	retval = cgroup_path(css->cgroup, buf, PAGE_SIZE);
+	rcu_read_unlock();
 	if (retval < 0)
-		goto out_unlock;
+		goto out_put_task;
 	seq_puts(m, buf);
 	seq_putc(m, '\n');
-out_unlock:
-	mutex_unlock(&cpuset_mutex);
+out_put_task:
 	put_task_struct(tsk);
 out_free:
 	kfree(buf);
-- 
1.8.0.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-01-15 16:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-15  6:10 [PATCH 1/2] cpuset: fix RCU lockdep splat Li Zefan
     [not found] ` <50F4F2F1.8070107-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-01-15  6:11   ` [PATCH 2/2] cpuset: return the return value of cgroup_path() to userspace Li Zefan
     [not found]     ` <50F4F314.4040103-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-01-15 16:41       ` [PATCH 2/2] cpuset: drop spurious retval assignment in proc_cpuset_show() Tejun Heo
2013-01-15 16:40   ` [PATCH 1/2] cpuset: fix RCU lockdep splat Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).