[lxc-devel] [lxc/lxc] 3981d9: cgroup: Major rewrite of cgroup logic

GitHub noreply at github.com
Tue Sep 10 21:31:58 UTC 2013


  Branch: refs/heads/staging
  Home:   https://github.com/lxc/lxc
  Commit: 3981d96ea304ed7955d417cd97bb91704fc9de6d
      https://github.com/lxc/lxc/commit/3981d96ea304ed7955d417cd97bb91704fc9de6d
  Author: Christian Seiler <christian at iwakd.de>
  Date:   2013-09-10 (Tue, 10 Sep 2013)

  Changed paths:
    M src/lxc/attach.c
    M src/lxc/cgroup.c
    M src/lxc/cgroup.h
    M src/lxc/commands.c
    M src/lxc/freezer.c
    M src/lxc/lxc.h
    M src/lxc/lxccontainer.c
    M src/lxc/lxcutmp.c
    M src/lxc/start.c
    M src/lxc/start.h
    M src/lxc/state.c
    M src/lxc/utils.c
    M src/tests/cgpath.c

  Log Message:
  -----------
  cgroup: Major rewrite of cgroup logic

This patch rewrites most of the cgroup logic. It creates a set of data
structures to store the kernel state of the cgroup hierarchies and
their mountpoints.

Mainly, everything is now grouped with respect to the hierarchies of
the system. Multiple controllers may be mounted together or separately
to different hierarchies, the data structures reflect this.

Each hierarchy may have multiple mount points (that were created
previously using the bind mount method) and each of these mount points
may point to a different prefix inside the cgroup tree. The current
code does not make any assumptions regarding the mount points, it just
parses /proc/self/mountinfo to acquire the relevant information.

The only requirement is that the current cgroup of either init (if
cgroup.pattern starts with '/' and the tools are executed as root) or
the current process (otherwise) are accessible. The root cgroup need
not be accessible.

The configuration option cgroup.pattern is introduced. For
root-executed containers, it specifies which format the cgroups should
be in. Example values may include '/lxc/%n', 'lxc/%n', '%n' or
'/machine/%n.lxc'. Any occurrence of '%n' is replaced with the name of
the container (and if clashes occur in any hierarchy, -1, -2, etc. are
appended globally). If the pattern starts with /, new containers'
cgroups will be located relative to init's cgroup; if it doesn't, they
will be located relative to the current process's cgroup.

Some changes to the cgroup.h API have been done to make it more
consistent, both with respect to naming and with respect to the
parameters. This causes some changes in other parts of the code that
are included in the patch.

There has been some testing of this functionality, but there are
probably still quite a few bugs in there, especially for people with
different configurations.

Signed-off-by: Christian Seiler <christian at iwakd.de>
Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>


  Commit: 0a556ccdf5ef50628cbc8fdb1ed016f80ee1137a
      https://github.com/lxc/lxc/commit/0a556ccdf5ef50628cbc8fdb1ed016f80ee1137a
  Author: Serge Hallyn <serge.hallyn at ubuntu.com>
  Date:   2013-09-10 (Tue, 10 Sep 2013)

  Changed paths:
    M src/lxc/cgroup.c

  Log Message:
  -----------
  don't use cgroup_path_components un-initialized

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>


  Commit: 9ddcd34a2c578e028e35a45017f79383503defe4
      https://github.com/lxc/lxc/commit/9ddcd34a2c578e028e35a45017f79383503defe4
  Author: Serge Hallyn <serge.hallyn at ubuntu.com>
  Date:   2013-09-10 (Tue, 10 Sep 2013)

  Changed paths:
    M src/lxc/cgroup.c

  Log Message:
  -----------
  lxc_cgroup_process_info_free_and_remove should recursively call itself

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>


Compare: https://github.com/lxc/lxc/compare/dcf2c26a4cf1...9ddcd34a2c57


More information about the lxc-devel mailing list