From: Tejun Heo Date: Tue, 6 Nov 2012 20:26:23 +0000 (-0800) Subject: Merge branch 'cgroup/for-3.7-fixes' into cgroup/for-3.8 X-Git-Tag: firefly_0821_release~3680^2~1492^2~46 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5b805f2a7675634fbdf9ac1c9b2256905ab2ea68;p=firefly-linux-kernel-4.4.55.git Merge branch 'cgroup/for-3.7-fixes' into cgroup/for-3.8 This is to receive device_cgroup fixes so that further device_cgroup changes can be made in cgroup/for-3.8. Signed-off-by: Tejun Heo --- 5b805f2a7675634fbdf9ac1c9b2256905ab2ea68 diff --cc kernel/cgroup.c index e3045ad4267a,f24f724620dd..3070164e2036 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@@ -4736,45 -4883,13 +4724,36 @@@ void cgroup_post_fork(struct task_struc */ if (use_task_css_set_links) { write_lock(&css_set_lock); - if (list_empty(&child->cg_list)) { - /* - * It's safe to use child->cgroups without task_lock() - * here because we are protected through - * threadgroup_change_begin() against concurrent - * css_set change in cgroup_task_migrate(). Also - * the task can't exit at that point until - * wake_up_new_task() is called, so we are protected - * against cgroup_exit() setting child->cgroup to - * init_css_set. - */ + task_lock(child); + if (list_empty(&child->cg_list)) list_add(&child->cg_list, &child->cgroups->tasks); - } + task_unlock(child); write_unlock(&css_set_lock); } + + /* + * Call ss->fork(). This must happen after @child is linked on + * css_set; otherwise, @child might change state between ->fork() + * and addition to css_set. + */ + if (need_forkexit_callback) { + for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { + struct cgroup_subsys *ss = subsys[i]; + + /* + * fork/exit callbacks are supported only for + * builtin subsystems and we don't need further + * synchronization as they never go away. + */ + if (!ss || ss->module) + continue; + + if (ss->fork) + ss->fork(child); + } + } } + /** * cgroup_exit - detach cgroup from exiting task * @tsk: pointer to task_struct of exiting process