The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/1949
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === cpuset.effective_cpus is better because it does not include cpus which we cannot use. But it is not available on older kernels. In that case fall back to using cpuset.cpus and hoping for the best. Closes #1929 Signed-off-by: Serge Hallyn <serge.hal...@ubuntu.com>
From 9e852bc662a8c612d9fdb28c72d0e4ce4b1bbb11 Mon Sep 17 00:00:00 2001 From: Serge Hallyn <serge.hal...@ubuntu.com> Date: Tue, 26 Apr 2016 15:59:05 -0500 Subject: [PATCH] cpuset: fall back to cpuset.cpus on older kernels cpuset.effective_cpus is better because it does not include cpus which we cannot use. But it is not available on older kernels. In that case fall back to using cpuset.cpus and hoping for the best. Closes #1929 Signed-off-by: Serge Hallyn <serge.hal...@ubuntu.com> --- lxd/devices.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lxd/devices.go b/lxd/devices.go index f25a02c..6504fb6 100644 --- a/lxd/devices.go +++ b/lxd/devices.go @@ -184,8 +184,13 @@ func deviceTaskBalance(d *Daemon) { // Get effective cpus list - those are all guaranteed to be online effectiveCpus, err := cGroupGet("cpuset", "/", "cpuset.effective_cpus") if err != nil { - shared.Log.Error("Error reading host's cpuset.effective_cpus") - return + // Older kernel - use cpuset.cpus + shared.Log.Warn("Failed reading host's cpuset.effective_cpus, falling back to cpuset.cpus") + effectiveCpus, err = cGroupGet("cpuset", "/", "cpuset.cpus") + if err != nil { + shared.Log.Error("Error reading host's cpuset.cpus") + return + } } err = cGroupSet("cpuset", "/lxc", "cpuset.cpus", effectiveCpus) if err != nil && shared.PathExists("/sys/fs/cgroup/cpuset/lxc") { @@ -193,7 +198,7 @@ func deviceTaskBalance(d *Daemon) { } cpus, err := parseCpuset(effectiveCpus) if err != nil { - shared.Log.Error("Error parsing host's cpuset.effective_cpus", log.Ctx{"cpuset": effectiveCpus, "err": err}) + shared.Log.Error("Error parsing host's cpu set", log.Ctx{"cpuset": effectiveCpus, "err": err}) return }
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel