[lxc-devel] cgroup V2 and LXC

Serge Hallyn serge.hallyn at ubuntu.com
Mon Feb 1 04:56:08 UTC 2016


Quoting Kevin Wilson (wkevils at gmail.com):
> Hi, LXC developers,
> 
> The latest kernel release (4.4) includes initial support to cgroup v2
> with 2 controllers (memory and io). Also it seems that the PIDs
> controller works in cgroup v2, but I do not know if it is officially
> supported in v2.
> 
> Is there any intention to replace the existing cgroup v1 usage in LXC
> by cgroup v2 ? or at least to enable working with both of them ?
> 
> Regards,
> Kevin

Replace, no, support, yes.  I've added support for it to cgmanager, and have
used lxc with the unified hierarchy through cgmanager.  Without cgmanager
it will currently definately not work.  It's worth discussing how we should
handle it - and how init wants us to handle it.   With cgmanager I actually
built in the support so that you could treat it as a legacy hierarchy, and
upstart was happy with that since it used cgmanager.  Systemd will not be
happy with that, and it will be a problem.  The only exception to the "no
tasks in a non-leaf node" rule is for the / cgroup.  So lxc would need to
place init in say /lxc/c1/.leaf, and systemd would have to accept that
/lxc/c1 is the container's cgroup.  A few possibilities:

1. maybe if we place systemd in /lxc/c1/init.scope it will be happy
2. maybe we can teach systemd to accept being in a leaf node
3. maybe we can build an exception into cgroup namespaces such that
a cgns root also is an exception to the no-tasks-in-non-leaf-nodes
rule.  But I doubt that will fly.


More information about the lxc-devel mailing list