conf: Move virDomainObj::originalMemlock into qemuDomainObjPrivate

Since v1.3.0-90-gafbe1d4c56 the original value of memlock limit
is stored inside virDomainObj struct directly (under
originalMemlock member). This is needless because the value is
used only inside QEMU driver and thus can reside in
qemuDomainObjPrivate struct.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Michal Privoznik 2022-05-11 16:27:18 +02:00
parent 2ba73a10fd
commit 75df6d2c29
3 changed files with 8 additions and 7 deletions

View File

@ -3064,9 +3064,6 @@ struct _virDomainObj {
int taint; int taint;
size_t ndeprecations; size_t ndeprecations;
char **deprecations; char **deprecations;
unsigned long long originalMemlock; /* Original RLIMIT_MEMLOCK, zero if no
* restore will be required later */
}; };
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainObj, virObjectUnref); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainObj, virObjectUnref);

View File

@ -9445,6 +9445,7 @@ int
qemuDomainAdjustMaxMemLock(virDomainObj *vm, qemuDomainAdjustMaxMemLock(virDomainObj *vm,
bool forceVFIO) bool forceVFIO)
{ {
qemuDomainObjPrivate *priv = vm->privateData;
unsigned long long currentMemLock = 0; unsigned long long currentMemLock = 0;
unsigned long long desiredMemLock = 0; unsigned long long desiredMemLock = 0;
@ -9457,8 +9458,8 @@ qemuDomainAdjustMaxMemLock(virDomainObj *vm,
/* If this is the first time adjusting the limit, save the current /* If this is the first time adjusting the limit, save the current
* value so that we can restore it once memory locking is no longer * value so that we can restore it once memory locking is no longer
* required */ * required */
if (vm->originalMemlock == 0) { if (priv->originalMemlock == 0) {
vm->originalMemlock = currentMemLock; priv->originalMemlock = currentMemLock;
} }
} else { } else {
/* If the limit is already high enough, we can assume /* If the limit is already high enough, we can assume
@ -9471,8 +9472,8 @@ qemuDomainAdjustMaxMemLock(virDomainObj *vm,
} else { } else {
/* Once memory locking is no longer required, we can restore the /* Once memory locking is no longer required, we can restore the
* original, usually very low, limit */ * original, usually very low, limit */
desiredMemLock = vm->originalMemlock; desiredMemLock = priv->originalMemlock;
vm->originalMemlock = 0; priv->originalMemlock = 0;
} }
if (desiredMemLock > 0 && if (desiredMemLock > 0 &&

View File

@ -241,6 +241,9 @@ struct _qemuDomainObjPrivate {
GSList *dbusVMStateIds; GSList *dbusVMStateIds;
/* true if -object dbus-vmstate was added */ /* true if -object dbus-vmstate was added */
bool dbusVMState; bool dbusVMState;
unsigned long long originalMemlock; /* Original RLIMIT_MEMLOCK, zero if no
* restore will be required later */
}; };
#define QEMU_DOMAIN_PRIVATE(vm) \ #define QEMU_DOMAIN_PRIVATE(vm) \