Re: [PATCH] kernel/sched: Fix sched_fork() access an invalid sched_task_group
From: Tejun Heo
Date: Wed Sep 08 2021 - 12:29:43 EST
Hello,
On Wed, Sep 08, 2021 at 07:32:06PM +0800, Zhang Qiao wrote:
> I will update this patch by following the steps below:
> 1)rename cgroup_subsys->fork() to cgroup_subsys->post_fork();
> 2)add cgroup_subsys->fork() and the cpu_cgroup_fork() callback like this:
>
> void cpu_cgroup_fork(struct task_struct *task) {
> ....
> p->sched_task_group = task_group(current);
> __set_task_cpu(p, smp_processor_id());
> if (p->sched_class->task_fork)
> p->sched_class->task_fork(p);
> ....
>
>
> 3)call cgroup_subsys->fork() after cgroup_can_fork().
>
> Do you have any suggestion?
I'm not following why it needs to shuffle the callbacks. Can't you just
relocate the fectching of task_group after can_fork?
Thanks.
--
tejun