From: Li Zefan <lizefan@huawei.com>
To: Tejun Heo <tj@kernel.org>
Cc: Sasha Levin <sasha.levin@oracle.com>,
LKML <linux-kernel@vger.kernel.org>,
Cgroups <cgroups@vger.kernel.org>
Subject: [PATCH 1/2] cpuset: fix RCU lockdep splat
Date: Tue, 15 Jan 2013 14:10:57 +0800 [thread overview]
Message-ID: <50F4F2F1.8070107@huawei.com> (raw)
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
next reply other threads:[~2013-01-15 6:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-15 6:10 Li Zefan [this message]
[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
2013-01-15 6:11 ` 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:41 ` Tejun Heo
2013-01-15 16:40 ` [PATCH 1/2] cpuset: fix RCU lockdep splat Tejun Heo
2013-01-15 16:40 ` Tejun Heo
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=50F4F2F1.8070107@huawei.com \
--to=lizefan@huawei.com \
--cc=cgroups@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sasha.levin@oracle.com \
--cc=tj@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.