[PATCH 7/9] [RFC] Support multiply-bindable cgroup subsystems

KAMEZAWA Hiroyuki kamezawa.hiroyu at jp.fujitsu.com
Wed Jul 1 20:16:26 PDT 2009


On Wed, 1 Jul 2009 19:52:16 -0700
Paul Menage <menage at google.com> wrote:

> On Wed, Jul 1, 2009 at 7:45 PM, KAMEZAWA
> Hiroyuki<kamezawa.hiroyu at jp.fujitsu.com> wrote:
> >> - in the current version of this patch, mounting a cgroups hierarchy
> >>   with no options does *not* get you any of the multi-bindable
> >>   subsystems; possibly for consistency it should give you all of the
> >>   multi-bindable subsystems as well as all of the single-bindable
> >>   subsystems.
> >>
> > I don't think this is a big problem. Hmm, I wonder there are no people who
> > uses cgroup without any options (= mounts all subsys at once)...
> 
> In practice I suspect that it's a rare usage outside of manual
> playing/testing - any real production system is going to want to be
> aware of what subsystems are available and decide which to mount on
> each hierarchy.
> 
> >
> > Wow...seems complicated. How about adding linux/cgroup_multisubsys.h ?
> 
> I think that the readability benefits in cgroup.c would be outweighed
> by having two different subsys include files.
> 

Hm, then, moving SUBSYS() macro to linux/cgroup_subsys.h is a sane way, I think.
IMHO, it's not very good habit that cgroup_subsys.h is parsed in different ways in
cgroup.h and cgroup.c

I think cgroup_subsys.h like following is much simpler even if it's not very
sophisticated.
==
#define SUBSYSID(_name)		_name ## _subsys_id,
#define SUBSYSP(_name)		&_name ## _subsys,

#ifdef CONFIG_CPUSETS
#define CPUSETS_ID		SUBSYSID(cpuset)
#define CPUSETS_SUBSYS		SUBSYSP(cpuset)
#else
#define CPUSETS_ID		
#define CPUSETS_SUBSYS		
#endif

#ifdef CONFIG_CPU
#define CPU_ID			SUBSYSID(cpu)
#define CPU_SUBSYS		SUBSYSP(cpu)
#else
#define CPU_ID
#define CPU_SUBSYS
#endif

#ifdef CONFIG_MEMORY
#define MEMORY_ID		SUBSYSID(memory)
#define MEMORY_SUBSYS		SUBSYSP(memory)
#else
#define MEMORY_ID
#define MEMORY_SUBSYS
#endif

#define CGROUP_ALL_SUBSYSID	CPUSETS_ID CPU_ID MEMORY_ID
#define CGROUP_ALL_SUBSYSP	CPUSETS_SUBSYS CPU_SUBSYS MEMORY_SUBSYS

==
But I know I'm not a man who can talk about beauty of codes ;)

Thanks,
-Kame



More information about the Containers mailing list