aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/cpuset.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 681a5d58d40d..e04c2da9dadb 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -647,10 +647,15 @@ void cpuset_update_task_memory_state()
647 struct task_struct *tsk = current; 647 struct task_struct *tsk = current;
648 struct cpuset *cs; 648 struct cpuset *cs;
649 649
650 rcu_read_lock(); 650 if (tsk->cpuset == &top_cpuset) {
651 cs = rcu_dereference(tsk->cpuset); 651 /* Don't need rcu for top_cpuset. It's never freed. */
652 my_cpusets_mem_gen = cs->mems_generation; 652 my_cpusets_mem_gen = top_cpuset.mems_generation;
653 rcu_read_unlock(); 653 } else {
654 rcu_read_lock();
655 cs = rcu_dereference(tsk->cpuset);
656 my_cpusets_mem_gen = cs->mems_generation;
657 rcu_read_unlock();
658 }
654 659
655 if (my_cpusets_mem_gen != tsk->cpuset_mems_generation) { 660 if (my_cpusets_mem_gen != tsk->cpuset_mems_generation) {
656 down(&callback_sem); 661 down(&callback_sem);