From: Peter Zijlstra <peterz@infradead.org>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Mike Galbraith <efault@gmx.de>,
hartsjc@redhat.com, vbendel@redhat.com, vlovejoy@redhat.com,
linux-kernel@vger.kernel.org
Subject: Re: sched/autogroup: race if !sysctl_sched_autogroup_enabled ?
Date: Wed, 9 Nov 2016 18:50:05 +0100 [thread overview]
Message-ID: <20161109175005.GS3142@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20161109165933.GA26071@redhat.com>
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.
next prev parent reply other threads:[~2016-11-09 17:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-09 16:59 Oleg Nesterov
2016-11-09 17:50 ` Peter Zijlstra [this message]
2016-11-10 13:09 ` Oleg Nesterov
2016-11-11 16:57 ` Oleg Nesterov
2016-11-13 13:59 ` Mike Galbraith
2016-11-14 15:14 ` Oleg Nesterov
2016-11-12 12:12 ` Mike Galbraith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161109175005.GS3142@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=efault@gmx.de \
--cc=hartsjc@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=torvalds@linux-foundation.org \
--cc=vbendel@redhat.com \
--cc=vlovejoy@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome