sched: silence PROVE_RCU in sched_fork()
[firefly-linux-kernel-4.4.55.git] / kernel / sched.c
index f8b8996228dd7d8de9ee49a845a193921f1b8a5d..a2d215d132f630ec8ed7dcf03af24b3c8524d966 100644 (file)
@@ -2494,7 +2494,16 @@ void sched_fork(struct task_struct *p, int clone_flags)
        if (p->sched_class->task_fork)
                p->sched_class->task_fork(p);
 
+       /*
+        * The child is not yet in the pid-hash so no cgroup attach races,
+        * and the cgroup is pinned to this child due to cgroup_fork()
+        * is ran before sched_fork().
+        *
+        * Silence PROVE_RCU.
+        */
+       rcu_read_lock();
        set_task_cpu(p, cpu);
+       rcu_read_unlock();
 
 #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
        if (likely(sched_info_on()))