From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964817AbbCPQmV (ORCPT ); Mon, 16 Mar 2015 12:42:21 -0400 Received: from mail-qc0-f175.google.com ([209.85.216.175]:36036 "EHLO mail-qc0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933261AbbCPQmS (ORCPT ); Mon, 16 Mar 2015 12:42:18 -0400 Date: Mon, 16 Mar 2015 12:42:14 -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 v6 1/3] cgroups: use bitmask to filter for_each_subsys Message-ID: <20150316164214.GB8353@htj.duckdns.org> References: <1426307835-5893-1-git-send-email-cyphar@cyphar.com> <1426307835-5893-2-git-send-email-cyphar@cyphar.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1426307835-5893-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 Hello, On Sat, Mar 14, 2015 at 03:37:13PM +1100, Aleksa Sarai wrote: > -/* This flag indicates whether tasks in the fork and exit paths should > +/* > + * This bitmask flag indicates whether tasks in the fork and exit paths should Please reflow the comment. It's going over 80col. Also, wouldn't it be clearer if the comment actually stated that the bitmask is subsystem bitmask? > @@ -4932,7 +4946,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->fork || ss->exit) << ss->id; I generally prefer (bool) casts to !!'s these days but this doesn't really matter. More importantly, shouldn't we be splitting fork and exit masks so that we don't have to test the callback existence later? > @@ -5239,11 +5253,9 @@ void cgroup_post_fork(struct task_struct *child) > * css_set; otherwise, @child might change state between ->fork() > * and addition to css_set. > */ > - if (need_forkexit_callback) { > - for_each_subsys(ss, i) > - if (ss->fork) > - ss->fork(child); > - } > + for_each_subsys_which(need_forkexit_callback, ss, i) > + if (ss->fork) > + ss->fork(child); > } IOW, we should be able to do for_each_subsys_which(subsys_has_fork, ss, i) ss->fork(child); And ditto for exit. Thanks. -- tejun