From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966036AbbDVPm0 (ORCPT ); Wed, 22 Apr 2015 11:42:26 -0400 Received: from casper.infradead.org ([85.118.1.10]:55513 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965472AbbDVPmU (ORCPT ); Wed, 22 Apr 2015 11:42:20 -0400 Date: Wed, 22 Apr 2015 17:42:12 +0200 From: Peter Zijlstra To: Tejun Heo Cc: Aleksa Sarai , lizefan@huawei.com, mingo@redhat.com, richard@nod.at, fweisbec@gmail.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Subject: Re: [PATCH v10 1/4] cgroups: use bitmask to filter for_each_subsys Message-ID: <20150422154212.GE3007@worktop.Skamania.guest> References: <1429446154-10660-1-git-send-email-cyphar@cyphar.com> <1429446154-10660-2-git-send-email-cyphar@cyphar.com> <20150422152551.GA10738@htj.duckdns.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150422152551.GA10738@htj.duckdns.org> User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 22, 2015 at 11:25:51AM -0400, Tejun Heo wrote: > Hello, Aleksa. > > On Sun, Apr 19, 2015 at 10:22:31PM +1000, Aleksa Sarai wrote: > > -static int need_forkexit_callback __read_mostly; > > +static int need_fork_callback __read_mostly; > > +static int need_exit_callback __read_mostly; > > These are bitmasks now, right? Let's make them unsigned int. If, as per the below you want to use the bitmap ops; it needs be unsigned long. > > static struct cftype cgroup_dfl_base_files[]; > > +#define for_each_subsys_which(ss_mask, ss, ssid) \ > > + for_each_subsys((ss), (ssid)) \ > > + if ((ss_mask) & (1 << (ssid))) > > Maybe using for_each_set_bit() is better? > > #define for_each_subsys_which(ss_mask, ss, ssid) \ > for_each_set_bit(ssid, &(ss_mask), CGROUP_SUBSYS_COUNT) \ > if ((ss) = group_subsys[ssid] && false) \ > ; \ > else Clever that ;-)