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