From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753092AbbCZPCu (ORCPT ); Thu, 26 Mar 2015 11:02:50 -0400 Received: from mail-qg0-f53.google.com ([209.85.192.53]:33862 "EHLO mail-qg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752704AbbCZPCp (ORCPT ); Thu, 26 Mar 2015 11:02:45 -0400 Date: Thu, 26 Mar 2015 11:02:23 -0400 From: Tejun Heo To: Aleksa Sarai Cc: lizefan@huawei.com, mingo@redhat.com, peterz@infradead.org, richard@nod.at, =?iso-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Subject: Re: [PATCH v6 2/3] cgroups: allow a cgroup subsystem to reject a fork Message-ID: <20150326150223.GA1953@htj.duckdns.org> References: <1426307835-5893-1-git-send-email-cyphar@cyphar.com> <1426307835-5893-3-git-send-email-cyphar@cyphar.com> <20150316165335.GC8353@htj.duckdns.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Hello, On Fri, Mar 27, 2015 at 01:38:54AM +1100, Aleksa Sarai wrote: > The issue I can see with passing around an opaque pointer to fork() is that you > have a random private (void **) argument that is completely useless if you > don't use can_fork(). This is why I think we should call the reapply_fork() Just pass NULL? I really don't like having another callback. pre and post do make sense because the operation is essentially a transaction. The problem with adding additional callbacks is that they aren't essential and as such arbitrary to a certain degree. reapply_fork or whatnot may fit this case but may not others, so let's please stick with what the logic dictates to be essential. > callback if the association changes [we could call it something else if you > like, since reapply_fork() is a pids-specific name -- what about switch_fork(), > reassoc_fork(), re_fork() or something to show that it's a callback if the > association changes?] (the subsystem can decide if they want to ignore it / if > they don't want to touch it) and we deal with pinning / dropping the ref of the > css_set for the current task inside the cgroup_* callbacks. That way, we don't > start messing around with post-fork() callbacks that aren't related to the new > conditional stuff. You can't pin css_set from inside cgroup callbacks. It's a construct which in general shouldn't be accessible outside cgroup core. > I mean, if you want to have a random, completely unused and essentially > vestigial argument to ss->fork() [if you don't use the new can_fork() callbacks > (and actually care about storing private data)] then I can just write that. It > just looks like a weird callback API imho. It's an opaque token from pre. If a subsys doesn't have pre, it's NULL. I don't see anything weird about that, so let's please go that way. Thanks. -- tejun