Re: [PATCH] sched: reset sched_entity depth on changing parent

From: Kirill Tkhai
Date: Mon Oct 27 2014 - 09:48:20 EST




27.10.2014, 16:45, "Peter Zijlstra" <peterz@xxxxxxxxxxxxx>:
> On Mon, Oct 27, 2014 at 04:36:02PM +0300, Kirill Tkhai wrote:
>>  27.10.2014, 16:28, "Peter Zijlstra" <peterz@xxxxxxxxxxxxx>:
>>>  On Mon, Oct 27, 2014 at 08:40:02AM -0400, Tejun Heo wrote:
>>>>   On Mon, Oct 27, 2014 at 01:07:34PM +0100, Peter Zijlstra wrote:
>>>>>   On Fri, Oct 24, 2014 at 09:18:42PM +0400, Kirill Tkhai wrote:
>>>>>>   I was seeking a places where task_group of a task may change. I can't understand
>>>>>>   how changing of parent's cgroup during fork() applies to a child.
>>>>>   I didn't know we could change cgroup on fork(), I though the idea was
>>>>>   you always inherited your parents cgroup.
>>>>>
>>>>>   How can this be?
>>>>   Hmmm? -ENEEDMORECONTEXT but the inheriting happens at one point during
>>>>   fork in cgroup_post_fork().  The child inherits whatever the parent
>>>>   cgroup is at that point.
>>>  So Kirill is saying that there is a race between fork and attach such
>>>  that a child can end up in a different cgroup than the parent and we
>>>  need to use the cgroup_subsys::fork call to fix that up.
>>  I mean cgroup is the same, but sched_task_group is other (sched_task_group
>>  is equal to parent's on the moment of dup_task_struct()).
>
> But that still means the parent changed cgroup during fork right? It
> started out in a different cgroup than it ended up with, and we need
> that .fork callback to fixup state.

Yeah, I'm agree.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/