Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8563835ybl; Thu, 16 Jan 2020 19:42:09 -0800 (PST) X-Google-Smtp-Source: APXvYqyO+vpOow8/rHuAL9CFPKRGEoeSicBk5sjQJWoc/KbzQ+m1jC7UkVlk+cHZXP3Ki6zq45dt X-Received: by 2002:a9d:5545:: with SMTP id h5mr4832212oti.296.1579232529517; Thu, 16 Jan 2020 19:42:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579232529; cv=none; d=google.com; s=arc-20160816; b=TfGGrx/Bo1cMomzvkxCsvIGV+tEBWPxCQaDAH6GW8h9dlxLc70/Xi/dsl6vUtnjP/m CtA2im8ZcispIOUpUo5LV1Y2GJ5KZYnPDWMUhUo4T/WN/XQpeYGVSaQo0E1WKwdtTgFB gGuKhvmqFAPpZpOGnGys9k+JkCuulYVtn1tS7z74JzcCt/4V2ufEoPT7bzkdBD95Z2j4 HrI1HyndSgWtVb1Li6iGFC6fPbjBIw7A1eTbcS7SVCbrDZVrOAEvMS4eWV8mXPGKLbXr ShKOhjiR2obZp9YKrf8aiqVHlN7iEbVQRJdrvjfGLItyg6YUZNDMv2NQs23GD0ry5Mom PaOA== 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=9lRldACgJod9eKtcTeButlgFlmgV2RFo5YObSOiQxXc=; b=k6Ewo0PXmVashMTcdLTZP6DwFWiONIjw0cM86xZrrKDjjiBp94+mbB+1nbPQOwlki2 yoZ3uZqTFQLXZB+u7ZSYLpQaP67DP/2NHRt+2RRe7deffVmyo9LEGo11DYHAOvkpLtxs Zqidq+l0NQnhMZfSwPTI1MSgAJJpHnuxldelsQ2uSl94Sp0BpgQB3mqwKru9rJQf78nD 6B0WadlrzqrWs7X1UhSRz/ssP0iS4TaplgZe91Hn0bNveLw97nvK0lB+DpKCnD3u0XR0 Vz13m40OX+/2Kym1uzgmsmQr3Kc4mkxcOOLIODGYrXVviNUuYoS8rvtkw4yJoXeuC8QT 3n/g== 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 f17si13994188otq.96.2020.01.16.19.41.57; Thu, 16 Jan 2020 19:42:09 -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 S1726950AbgAPX5e (ORCPT + 99 others); Thu, 16 Jan 2020 18:57:34 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:53959 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726189AbgAPX5e (ORCPT ); Thu, 16 Jan 2020 18:57:34 -0500 Received: from ip5f5bd663.dynamic.kabel-deutschland.de ([95.91.214.99] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1isF0t-0008BL-JE; Thu, 16 Jan 2020 23:57:23 +0000 Date: Fri, 17 Jan 2020 00:57:22 +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: <20200116235721.tnadjblifqirg5bo@wittgenstein> References: <20191223061504.28716-1-christian.brauner@ubuntu.com> <20191223061504.28716-3-christian.brauner@ubuntu.com> <20200108160102.GA17415@blackbody.suse.cz> <20200108181049.ysmo73celrt4bvo2@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200108181049.ysmo73celrt4bvo2@wittgenstein> 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 07:10:49PM +0100, Christian Brauner wrote: > 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. Ok, this is way simpler I think, we just set the root_cset of the new cgroup namespace to the child's cset in cgroup_post_fork() if CLONE_NEWCGROUP is requested. Christian