1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-28 11:21:44 +03:00

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;
size_t ndeprecations;
char **deprecations;
unsigned long long originalMemlock; /* Original RLIMIT_MEMLOCK, zero if no
* restore will be required later */
};
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainObj, virObjectUnref);

View File

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

View File

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