]> rtime.felk.cvut.cz Git - lisovros/linux_canprio.git/blobdiff - kernel/sched.c
sched: fix RCU lockdep splat from task_group()
[lisovros/linux_canprio.git] / kernel / sched.c
index 3fd774c342143952c9fecc67b4a622227285953b..285f587225b36ae4c7ade78fa4a3fb5acaeb66bf 100644 (file)
@@ -5330,7 +5330,19 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu)
        idle->se.exec_start = sched_clock();
 
        cpumask_copy(&idle->cpus_allowed, cpumask_of(cpu));
+       /*
+        * We're having a chicken and egg problem, even though we are
+        * holding rq->lock, the cpu isn't yet set to this cpu so the
+        * lockdep check in task_group() will fail.
+        *
+        * Similar case to sched_fork(). / Alternatively we could
+        * use task_rq_lock() here and obtain the other rq->lock.
+        *
+        * Silence PROVE_RCU
+        */
+       rcu_read_lock();
        __set_task_cpu(idle, cpu);
+       rcu_read_unlock();
 
        rq->curr = rq->idle = idle;
 #if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW)