Messages in this thread | | | Date | Mon, 27 Oct 2014 13:21:46 +0100 | From | Peter Zijlstra <> | Subject | Re: [PATCH] sched: Fix race between task_group and sched_task_group |
| |
On Mon, Oct 27, 2014 at 02:18:25PM +0400, Kirill Tkhai wrote: > > The race may happen when somebody is changing task_group of a forking task. > Child's cgroup is the same as parent's after dup_task_struct() (there just > memory copying). Also, cfs_rq and rt_rq are the same as parent's. > > But if parent changes its task_group before it's called cgroup_post_fork(), > we do not reflect this situation on child. Child's cfs_rq and rt_rq remain > the same, while child's task_group changes in cgroup_post_fork(). > > To fix this we introduce fork() method, which calls sched_move_task() directly. > This function changes sched_task_group on appropriate (also its logic has > no problem with freshly created tasks, so we shouldn't introduce something > special; we are able just to use it).
Right, I read some of that cgroup.c stuff and this is indeed possible, yucky. Applied, thanks!
| |