[lxc-devel] [PATCH 6/6] cgroup: Major rewrite of cgroup logic

Christian Seiler christian at iwakd.de
Tue Sep 10 21:52:15 UTC 2013


Hi Serge,

Thanks for testing / reviewing!

> I'd like to just get rid of mountcgroups and make this a
> configurable option straight in lxc, which when set will cause lxc,
> for every mountpoint which is in handler->cgroup, bind-mount the
> the container init's directory into the container.  The question is,
> would $rootfs/sys/fs/cgroup/$controllername be an ok assumption for
> all distributions?  If not maybe we can't do this universally...
> But I should think it'd be ok.

As far as I know /sys/fs/cgroup/$controller with appropriate symlinks
(i.e. if cpu and cpuacct are mounted together, create a directory
cpu,cpuacct and symlink cpu and cpuacct to that directory) has become
standard. So I'd suggest using that as the current path to go forward,
and see later if we have to adjust that due to distribution's needs -
it's definitely better than the current state where cgroup support is
not available at all in containers out of the box. (Also, if somebody
needs something else, they can write an own hook and disable this
automation.)

Side note: But instead of mounting the container's directory directly to
/sys/fs/cgroup/$controller: as I said in an earlier thread it would
probably be better to mount the container's cgroup directory into
/sys/fs/cgroup/$controller/$cgrouppath and create that recursively
inside a tmpfs. Otherwise, this might really confuse other software that
looks for cgroups in specific locations.

If you're interested, I could implement that.

> In the meantime I'm going to push your patch to staging.

Great, thanks!

Final thought: Generally speaking, it'd probably be a good idea to have
some kind of support in LXC to mount all standard file systems (/proc,
/sys, tmpfs-/run, cgroups, etc.) which may be specified as a
configuration option. For example: 'lxc.mount.auto = proc sys run
cgroups' or so. That would save a lot of useless fstab entries in the
lxc configuration, ideally you'd need nothing for the simplest
configurations.

-- Christian




More information about the lxc-devel mailing list