render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
459f93
From 00c5cab2b92b653edbf491d9ef60359578c3d59a Mon Sep 17 00:00:00 2001
459f93
Message-Id: <00c5cab2b92b653edbf491d9ef60359578c3d59a@dist-git>
459f93
From: Michal Privoznik <mprivozn@redhat.com>
459f93
Date: Wed, 11 May 2022 16:27:18 +0200
459f93
Subject: [PATCH] conf: Move virDomainObj::originalMemlock into
459f93
 qemuDomainObjPrivate
459f93
459f93
Since v1.3.0-90-gafbe1d4c56 the original value of memlock limit
459f93
is stored inside virDomainObj struct directly (under
459f93
originalMemlock member). This is needless because the value is
459f93
used only inside QEMU driver and thus can reside in
459f93
qemuDomainObjPrivate struct.
459f93
459f93
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
459f93
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
459f93
(cherry picked from commit 75df6d2c291c48d65c1e54dd93e3d2d3cb0712e7)
459f93
459f93
https://bugzilla.redhat.com/show_bug.cgi?id=2089433
459f93
459f93
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
459f93
---
459f93
 src/conf/domain_conf.h | 3 ---
459f93
 src/qemu/qemu_domain.c | 9 +++++----
459f93
 src/qemu/qemu_domain.h | 3 +++
459f93
 3 files changed, 8 insertions(+), 7 deletions(-)
459f93
459f93
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
459f93
index d0d0fdc815..45976beb2b 100644
459f93
--- a/src/conf/domain_conf.h
459f93
+++ b/src/conf/domain_conf.h
459f93
@@ -3031,9 +3031,6 @@ struct _virDomainObj {
459f93
     int taint;
459f93
     size_t ndeprecations;
459f93
     char **deprecations;
459f93
-
459f93
-    unsigned long long originalMemlock; /* Original RLIMIT_MEMLOCK, zero if no
459f93
-                                         * restore will be required later */
459f93
 };
459f93
 
459f93
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainObj, virObjectUnref);
459f93
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
459f93
index 40fe9985e6..86d673dafa 100644
459f93
--- a/src/qemu/qemu_domain.c
459f93
+++ b/src/qemu/qemu_domain.c
459f93
@@ -9269,6 +9269,7 @@ int
459f93
 qemuDomainAdjustMaxMemLock(virDomainObj *vm,
459f93
                            bool forceVFIO)
459f93
 {
459f93
+    qemuDomainObjPrivate *priv = vm->privateData;
459f93
     unsigned long long currentMemLock = 0;
459f93
     unsigned long long desiredMemLock = 0;
459f93
 
459f93
@@ -9281,8 +9282,8 @@ qemuDomainAdjustMaxMemLock(virDomainObj *vm,
459f93
             /* If this is the first time adjusting the limit, save the current
459f93
              * value so that we can restore it once memory locking is no longer
459f93
              * required */
459f93
-            if (vm->originalMemlock == 0) {
459f93
-                vm->originalMemlock = currentMemLock;
459f93
+            if (priv->originalMemlock == 0) {
459f93
+                priv->originalMemlock = currentMemLock;
459f93
             }
459f93
         } else {
459f93
             /* If the limit is already high enough, we can assume
459f93
@@ -9295,8 +9296,8 @@ qemuDomainAdjustMaxMemLock(virDomainObj *vm,
459f93
     } else {
459f93
         /* Once memory locking is no longer required, we can restore the
459f93
          * original, usually very low, limit */
459f93
-        desiredMemLock = vm->originalMemlock;
459f93
-        vm->originalMemlock = 0;
459f93
+        desiredMemLock = priv->originalMemlock;
459f93
+        priv->originalMemlock = 0;
459f93
     }
459f93
 
459f93
     if (desiredMemLock > 0 &&
459f93
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
459f93
index e5046367e3..e9497d20de 100644
459f93
--- a/src/qemu/qemu_domain.h
459f93
+++ b/src/qemu/qemu_domain.h
459f93
@@ -241,6 +241,9 @@ struct _qemuDomainObjPrivate {
459f93
     GSList *dbusVMStateIds;
459f93
     /* true if -object dbus-vmstate was added */
459f93
     bool dbusVMState;
459f93
+
459f93
+    unsigned long long originalMemlock; /* Original RLIMIT_MEMLOCK, zero if no
459f93
+                                         * restore will be required later */
459f93
 };
459f93
 
459f93
 #define QEMU_DOMAIN_PRIVATE(vm) \
459f93
-- 
459f93
2.35.1
459f93