Skip to content

Commit

Permalink
cpuset: fix RCU lockdep splat in cpuset_print_task_mems_allowed()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Li Zefan authored and Tejun Heo committed Mar 12, 2013
1 parent ff794de commit cfb5966
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kernel/cpuset.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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();
}

/*
Expand Down

0 comments on commit cfb5966

Please sign in to comment.