Skip to content

Commit

Permalink
sched: silence PROVE_RCU in sched_fork()
Browse files Browse the repository at this point in the history
Because cgroup_fork() is ran before sched_fork() [ from copy_process() ]
and the child's pid is not yet visible the child is pinned to its
cgroup. Therefore we can silence this warning.

A nicer solution would be moving cgroup_fork() to right after
dup_task_struct() and exclude PF_STARTING from task_subsys_state().

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Reviewed-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
  • Loading branch information
Peter Zijlstra authored and Paul E. McKenney committed Jun 23, 2010
1 parent 94bfa3b commit 8695159
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down

0 comments on commit 8695159

Please sign in to comment.