diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 681a5d58d40dcf5b40d73da17639b4c7729a936c..e04c2da9dadbdd24b636ebd8f91884d03669d374 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c @@ -647,10 +647,15 @@ void cpuset_update_task_memory_state() struct task_struct *tsk = current; struct cpuset *cs; - rcu_read_lock(); - cs = rcu_dereference(tsk->cpuset); - my_cpusets_mem_gen = cs->mems_generation; - rcu_read_unlock(); + if (tsk->cpuset == &top_cpuset) { + /* Don't need rcu for top_cpuset. It's never freed. */ + my_cpusets_mem_gen = top_cpuset.mems_generation; + } else { + rcu_read_lock(); + cs = rcu_dereference(tsk->cpuset); + my_cpusets_mem_gen = cs->mems_generation; + rcu_read_unlock(); + } if (my_cpusets_mem_gen != tsk->cpuset_mems_generation) { down(&callback_sem);