]> git.ipfire.org Git - thirdparty/lxc.git/commit
cgroups: remove isolated cpus from cpuset.cpus 1282/head
authorChristian Brauner <christian.brauner@canonical.com>
Sun, 6 Nov 2016 18:50:54 +0000 (19:50 +0100)
committerChristian Brauner <christian.brauner@canonical.com>
Wed, 9 Nov 2016 18:28:02 +0000 (19:28 +0100)
commita54694f86dcf59fe514dbf2c505c1d7090d0d17d
tree88d0c7e28895d95b5cf87ca6e4e7fe98dca7740a
parent000dfda7f34171fc0596c0aa47dac3d0cc8d3bbc
cgroups: remove isolated cpus from cpuset.cpus

In case the system was booted with

    isolcpus=n_i-n_j,n_k,n_m

we cannot simply copy the cpuset.cpus file from our parent cgroup. For example,
in the root cgroup cpuset.cpus will contain all of the cpus including the
isolated cpus. Copying the values of the root cgroup into a child cgroup will
lead to a wrong view in /proc/self/status: For the root cgroup
/sys/fs/cgroup/cpuset /proc/self/status will correctly show

    Cpus_allowed_list:      0-1,3

even though cpuset.cpus will show

    0-3

However, initializing a subcgroup in the cpuset controller by copying the
cpuset.cpus setting from the root cgroup will cause /proc/self/status to
incorrectly show

    Cpus_allowed_list:      0-3

Hence, we need to make sure to remove the isolated cpus from cpuset.cpus. Seth
has argued that this is not a kernel bug but by design. So let us be the smart
guys and fix this in liblxc.

The solution is straightforward: To avoid having to work with raw cpulist
strings we create cpumasks based on uint32_t bit arrays.

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
src/lxc/cgroups/cgfsng.c
src/lxc/utils.c