Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1153795ybl; Wed, 8 Jan 2020 11:59:53 -0800 (PST) X-Google-Smtp-Source: APXvYqxD6Prd2NIEOfKQKYpQpfxRrN9vvSV2g8QkiOmJqurMUpSWejiKo4ZQ6Sz9XuuteH7KtURI X-Received: by 2002:aca:54cc:: with SMTP id i195mr251549oib.126.1578513593491; Wed, 08 Jan 2020 11:59:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578513593; cv=none; d=google.com; s=arc-20160816; b=I+o4dvf80kGqQAP2K+yeT4BwHuVqH6ilpMygSaJZ5S3DAsol3uFkQDXPLn1XFgZ/qN BcCWktjjDO6dsKorq8Qqztz5Kk7GpEufqDUyeD8g051aWX1aXoHtZguseRZaSJj/gAU6 edXriAqnMMZ091KgSroq4GQIbD1MGpaE1U6M9i5ZupuHRs2SMSuqkM+x3YiKRirX4VT1 J4sW4f4ULGl84e0XVxIgoOTVn76bfpCds6ok7fLVyZZ8OXtQcTmG1l0Ye+iH5fMhRNu4 yLWf62e5JBq/eC5YkHJInXEX4mNtVbCWjaOFyFEIiy7PkurR70M+F8C8Wm2ZDD41ANFe 9iow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=XXNUUuVP+EquzmW2S6/mWjW2LKZs9ju/ohlp9BIdyhQ=; b=g3mQEIgLTPNTGgJAiHt1NImZ1cZv2eZhV6JQurHuZZ2ltSFy43AVhQpCEMLuINHNI7 I+xdWCtDcH9KLdAVO3ejbEhJwx0CcLseXfNGiWHAwYajl87gsIVxzwZ8q+vO/2RqDg2z zee1YyOpvjl6ODPKDkXBXcnYk9ACquRVnup+LVWrJ65gwjglj5RebJfPAvvc/3rWywhd n80Z/6PfwoCcBdSg25ZbvUKdwSXWmu+9wb16pTAOQFQWW/+ATECXDNWpw9aFEeMOfsMI kEvV7l2NkqVox86sJh/OUV8wFi2ZuDM5dorJLtbK1AtQp3LUS0+96t9NJb52oDotEc1I 07Rw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k10si2219483oik.276.2020.01.08.11.59.41; Wed, 08 Jan 2020 11:59:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730173AbgAHSMj (ORCPT + 99 others); Wed, 8 Jan 2020 13:12:39 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:39438 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728749AbgAHSMi (ORCPT ); Wed, 8 Jan 2020 13:12:38 -0500 Received: from host.242.234.23.62.rev.coltfrance.com ([62.23.234.242] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1ipFn4-0007Nt-7L; Wed, 08 Jan 2020 18:10:46 +0000 Date: Wed, 8 Jan 2020 19:10:49 +0100 From: Christian Brauner To: Michal =?utf-8?Q?Koutn=C3=BD?= Cc: linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, Tejun Heo , Ingo Molnar , Oleg Nesterov , Johannes Weiner , Li Zefan , Peter Zijlstra , cgroups@vger.kernel.org Subject: Re: [PATCH v2 2/3] clone3: allow spawning processes into cgroups Message-ID: <20200108181049.ysmo73celrt4bvo2@wittgenstein> References: <20191223061504.28716-1-christian.brauner@ubuntu.com> <20191223061504.28716-3-christian.brauner@ubuntu.com> <20200108160102.GA17415@blackbody.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200108160102.GA17415@blackbody.suse.cz> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 08, 2020 at 05:01:02PM +0100, Michal Koutný wrote: > On Mon, Dec 23, 2019 at 07:15:03AM +0100, Christian Brauner wrote: > > This adds support for creating a process in a different cgroup than its > > parent. > Binding fork and migration together looks useful. > > > --- a/kernel/cgroup/cgroup.c > > +++ b/kernel/cgroup/cgroup.c > > @@ -5882,21 +5882,176 @@ void cgroup_fork(struct task_struct *child) > > INIT_LIST_HEAD(&child->cg_list); > Just a nitpick, I noticed the comment for cgroup_fork should be updated > too (generic migration happens in cgroup_post_fork). Thanks. > > > --- a/kernel/fork.c > > +++ b/kernel/fork.c > > [...] > > @@ -2279,8 +2278,7 @@ static __latent_entropy struct task_struct *copy_process( > > write_unlock_irq(&tasklist_lock); > > > > proc_fork_connector(p); > > - cgroup_post_fork(p); > > - cgroup_threadgroup_change_end(current); > > + cgroup_post_fork(current, p, args); > I can see that when CLONE_INTO_CGROUP | CLONE_NEWCGROUP is passed, then > the child's cgroup NS will be rooted at parent's css set > (copy_namespaces precedes cgroup_post_fork). > > Wouldn't it make better sense if this flags combination resulted in > child's NS rooted in its css set? I need to take a closer look but it sounds like we should move the copying of the cgroup namespace to a later point; but again I need to look into this. Thanks! Christian