public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Kirill Tkhai <tkhai@yandex.ru>,
	Burke Libbey <burke.libbey@shopify.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"mingo@kernel.org" <mingo@kernel.org>
Subject: Re: [PATCH] sched: reset sched_entity depth on changing parent
Date: Mon, 27 Oct 2014 09:47:35 -0400	[thread overview]
Message-ID: <20141027134735.GG4436@htj.dyndns.org> (raw)
In-Reply-To: <20141027132812.GG3337@twins.programming.kicks-ass.net>

Hello, Peter, Kirill.

On Mon, Oct 27, 2014 at 02:28:12PM +0100, Peter Zijlstra wrote:
...
> 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 was always under the impression that fork was an 'atomic' operation
> from the point of cgroups, an attach (or move) would happen either
> before the fork or after, not during. But I appear to be mistaken in
> that assumption, going by the comments around cgroup_post_fork().

cgroup migration is atomic against threadgroup changes - tasks joining
or leaving the threadgroup.  If a process is forking a child, the
child inherits the parent's cgroup at one point while forking and the
parent may have changed its cgroup while fork was in progress.  So,
yeah, it can't depend on the dup'd result to be correct.

Thanks.

-- 
tejun

  parent reply	other threads:[~2014-10-27 13:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-24 15:07 [PATCH] sched: reset sched_entity depth on changing parent Burke Libbey
2014-10-24 15:58 ` Peter Zijlstra
2014-10-24 17:18   ` Kirill Tkhai
2014-10-27  9:49     ` Kirill Tkhai
2014-10-27 12:07     ` Peter Zijlstra
2014-10-27 12:40       ` Tejun Heo
2014-10-27 13:28         ` Peter Zijlstra
2014-10-27 13:36           ` Kirill Tkhai
2014-10-27 13:45             ` Peter Zijlstra
2014-10-27 13:48               ` Kirill Tkhai
2014-10-27 13:47           ` Tejun Heo [this message]
2014-10-27 13:48             ` Tejun Heo

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=20141027134735.GG4436@htj.dyndns.org \
    --to=tj@kernel.org \
    --cc=burke.libbey@shopify.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tkhai@yandex.ru \
    /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