Re: [PATCH 6/6] cgroup: implement for_each_[builtin_]subsys()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 24, 2013 at 06:50:42PM +0800, Li Zefan wrote:
> > +/**
> > + * for_each_subsys - iterate all loaded cgroup subsystems
> > + * @ss: the iteration cursor
> > + * @i: the index of @ss, CGROUP_SUBSYS_COUNT after reaching the end
> > + */
> > +#define for_each_subsys(ss, i)						\
> 
> This should be called with cgroup_mutex held, so how about add a comment or
> a lock assert for it?

Will do.

> > +#define for_each_builtin_subsys(ss, i)					\
> > +	for ((i) = 0; (i) < CGROUP_BUILTIN_SUBSYS_COUNT &&		\
> > +	     (((ss) = cgroup_subsys[i]) || true); (i)++)
> 
> Why "true" is needed here? given ss can't be NULL.

Because the compiler doesn't know that and we want the compiler to
optimize out the conditional branch.

Thanks.

-- 
tejun
_______________________________________________
Containers mailing list
Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/containers




[Index of Archives]     [Cgroups]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux