From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751522AbbCIDGo (ORCPT ); Sun, 8 Mar 2015 23:06:44 -0400 Received: from mail-qg0-f54.google.com ([209.85.192.54]:46257 "EHLO mail-qg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750933AbbCIDGl (ORCPT ); Sun, 8 Mar 2015 23:06:41 -0400 Date: Sun, 8 Mar 2015 23:06:36 -0400 From: Tejun Heo To: Aleksa Sarai Cc: lizefan@huawei.com, mingo@redhat.com, peterz@infradead.org, richard@nod.at, fweisbec@gmail.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Subject: Re: [PATCH v2 1/2] cgroups: allow a cgroup subsystem to reject a fork Message-ID: <20150309030636.GC13283@htj.duckdns.org> References: <1424660891-12719-1-git-send-email-cyphar@cyphar.com> <1425010639-16492-1-git-send-email-cyphar@cyphar.com> <1425010639-16492-2-git-send-email-cyphar@cyphar.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1425010639-16492-2-git-send-email-cyphar@cyphar.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 27, 2015 at 03:17:18PM +1100, Aleksa Sarai wrote: ... > In order for can_fork to deal with a task that has an accurate css_set, > move the css_set updating to cgroup_fork (where it belongs). Hmmm? So, now the task is visible on cgroup side before the point of no return? What happens if fork fails afterwards? Also, why is this non-trivial change happening in tandem in this patch? > @@ -946,6 +950,11 @@ struct cgroup_subsys_state *css_tryget_online_from_dir(struct dentry *dentry, > static inline int cgroup_init_early(void) { return 0; } > static inline int cgroup_init(void) { return 0; } > static inline void cgroup_fork(struct task_struct *p) {} > +static inline int cgroup_can_fork(struct task_struct *p) > +{ > + return 0; > +} Please follow the surrounding style. > @@ -4928,7 +4928,7 @@ static void __init cgroup_init_subsys(struct cgroup_subsys *ss, bool early) > * init_css_set is in the subsystem's root cgroup. */ > init_css_set.subsys[ss->id] = css; > > - need_forkexit_callback |= ss->fork || ss->exit; > + need_forkexit_callback |= ss->can_fork || ss->cancel_fork || ss->fork || ss->exit; Your patch isn't the culprit but this is silly given that this flag is set pretty much whenever cgroups are enabled. Per-callback subsys mask would make far more sense. Thanks. -- tejun