From b9071a6dab43631d65ccf7cbb9c6f39769c86f09 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Wed, 3 Jul 2019 17:57:48 +0200 Subject: [PATCH] cgroups: hande cpuset initialization race Signed-off-by: Christian Brauner --- src/lxc/cgroups/cgfsng.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index 95a87d5aa9..a6e2d51b11 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -612,10 +612,8 @@ static bool cg_legacy_handle_cpuset_hierarchy(struct hierarchy *h, char *cgname) } /* Already set for us by someone else. */ - if (v == '1') { - DEBUG("\"cgroup.clone_children\" was already set to \"1\""); - return true; - } + if (v == '1') + TRACE("\"cgroup.clone_children\" was already set to \"1\""); /* copy parent's settings */ if (!copy_parent_file(cgpath, "cpuset.mems")) { From a29e5dc592481e7fc76a6c97ee62b4f9ef6f8b0e Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Sun, 28 Jul 2019 23:13:26 +0200 Subject: [PATCH] cgroups: initialize cpuset properly Closes #3108. Signed-off-by: Christian Brauner --- src/lxc/cgroups/cgfsng.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index a6e2d51b11..f341f06332 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -496,12 +496,12 @@ static bool cg_legacy_filter_and_set_cpus(char *path, bool am_initialized) } if (!flipped_bit) { - DEBUG("No isolated or offline cpus present in cpuset"); - return true; + cpulist = lxc_cpumask_to_cpulist(possmask, maxposs); + TRACE("No isolated or offline cpus present in cpuset"); + } else { + cpulist = move_ptr(posscpus); + TRACE("Removed isolated or offline cpus from cpuset"); } - DEBUG("Removed isolated or offline cpus from cpuset"); - - cpulist = lxc_cpumask_to_cpulist(possmask, maxposs); if (!cpulist) { ERROR("Failed to create cpu list"); return false;