[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161109175005.GS3142@twins.programming.kicks-ass.net>
Date: Wed, 9 Nov 2016 18:50:05 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Ingo Molnar <mingo@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Mike Galbraith <efault@....de>, hartsjc@...hat.com,
vbendel@...hat.com, vlovejoy@...hat.com,
linux-kernel@...r.kernel.org
Subject: Re: sched/autogroup: race if !sysctl_sched_autogroup_enabled ?
On Wed, Nov 09, 2016 at 05:59:33PM +0100, Oleg Nesterov wrote:
> We need to ensure that autogroup/tg returned by autogroup_task_group()
> can't go away if we race with autogroup_move_group(), and unless the
> caller holds ->siglock we rely on fact that autogroup_move_group()
> will a) see this task and b) do sched_move_task() which needs the same
> same rq->lock.
>
> However. autogroup_move_group() skips for_each_thread/sched_move_task
> if sysctl_sched_autogroup_enabled == 0.
>
> So. Doesn't this mean that cgroup migration to the root cgroup can race
> with autogroup_move_group() and use the soon-to-be-freed autogroup->tg?
Argh, its too late for this, also jet-lag. But maybe, I can sort of feel
a hole here but cannot for the life of me still think.
> although this is a bit off-topic. Another question is that I fail to
> understand why sched_autogroup_create_attach() does autogroup_create()
> and changes signal->autogroup even if !sysctl_sched_autogroup_enabled.
I really cannot remember back that far, but it could be to allow
flipping it back on. Then again, I don't think the fork path puts new
tasks in, even if the autogroup exists.
Powered by blists - more mailing lists