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
--
To unsubscribe from this list: send the line "unsubscribe cgroups" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux