lkml.org 
[lkml]   [2015]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v10 1/4] cgroups: use bitmask to filter for_each_subsys
Hey,

On Wed, Apr 22, 2015 at 05:42:12PM +0200, Peter Zijlstra wrote:
> If, as per the below you want to use the bitmap ops; it needs be
> unsigned long.

Ah, right.

> > > 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 ;-)

Thanks. It kinda bothers me that for_each_set_bit() doesn't collapse
to combo of ffs() + clearing bit off of a temp mask when size is const
and <= ulong, which would be quite a bit lighter. Right now it'd be
calling into generic find_first/next_bit() functions unconditionally.
Ah well, it can be optimized later.

--
tejun


\
 
 \ /
  Last update: 2015-04-22 18:21    [W:0.083 / U:26.456 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site