]> git.proxmox.com Git - mirror_lxc.git/commit - src/lxc/start.c
cgroups: refactor cgroup handling
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 18 May 2018 18:16:22 +0000 (20:16 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sat, 19 May 2018 20:33:34 +0000 (22:33 +0200)
commit2202afc960d7d90df1fd5a1bb27be2529fcc235b
tree702e6d3e070b3d4c06f9db2edaa6e603bf0fe564
parentb5ead53aaff18cff3fa60f0d66ff6734be779c6a
cgroups: refactor cgroup handling

This replaces the constructor implementation of cgroup handling with a simpler,
thread-safe on-demand model of cgroup driver initialization.
Making the cgroup initialization code run in a constructor means that each time
the shared library gets mapped the cgroup parsing code gets run. That's
unnecessary overhead.
It also feels to me that this is only accidently thread-safe because
constructors are only run once. But should threads actually end up manipulating
or freeing memory that is file-global to cgfsng.c we'd be screwed. Now, I might
be wrong here but the cleaner implementation is to allocate a cgroup driver on
demand whenever we need it.
Take the chance and rework the cgroup_ops interface to make the functions it
wants to have implemented a lot cleaner.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
13 files changed:
src/lxc/attach.c
src/lxc/cgroups/cgfsng.c
src/lxc/cgroups/cgroup.c
src/lxc/cgroups/cgroup.h
src/lxc/commands.c
src/lxc/conf.c
src/lxc/criu.c
src/lxc/freezer.c
src/lxc/lxc.h
src/lxc/lxccontainer.c
src/lxc/start.c
src/lxc/start.h
src/tests/cgpath.c