[PATCH v2 3/3] virLXCControllerSetupResourceLimits: Call virNuma*() iff needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Like we are doing in qemu driver
($COMMIT_HASH_TO_BE_FILLED_DURING_PUSHING), lets call
virNumaSetupMemoryPolicy() only if really needed. Problem is, if
we numa_set_membind() child, there's no way to change it from the
daemon afterwards. So any later attempts to change the pinning
will fail. But in very weird way - CGroups will be set, but due
to membind child will not allocate memory from any other node.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/lxc/lxc_controller.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 8545f29..4b340ab 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -742,14 +742,24 @@ static int virLXCControllerSetupResourceLimits(virLXCControllerPtr ctrl)
     virBitmapPtr nodeset = NULL;
     virDomainNumatuneMemMode mode;
 
-    VIR_DEBUG("Setting up process resource limits");
-
-    if (virLXCControllerGetNumadAdvice(ctrl, &auto_nodeset) < 0)
-        goto cleanup;
-
-    nodeset = virDomainNumatuneGetNodeset(ctrl->def->numa, auto_nodeset, -1);
     mode = virDomainNumatuneGetMode(ctrl->def->numa, -1);
 
+    if (mode == VIR_DOMAIN_NUMATUNE_MEM_STRICT &&
+        virCgroupControllerAvailable(VIR_CGROUP_CONTROLLER_CPUSET)) {
+        /* Use virNuma* API iff necessary. Once set and child is exec()-ed,
+         * there's no way for us to change it. Rely on cgroups (if available
+         * and enabled in the config) rather then virNuma*. */
+        VIR_DEBUG("Postponing setting up resource limits to CGroup set up phase");
+        return virLXCControllerSetupCpuAffinity(ctrl);
+    }
+
+    VIR_DEBUG("Setting up process resource limits");
+
+    if (virLXCControllerGetNumadAdvice(ctrl, &auto_nodeset) < 0)
+        goto cleanup;
+
+    nodeset = virDomainNumatuneGetNodeset(ctrl->def->numa, auto_nodeset, -1);
+
     if (virNumaSetupMemoryPolicy(mode, nodeset) < 0)
         goto cleanup;
 
-- 
2.0.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]