mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-12 22:51:29 +00:00
qemu: cgroup: Store auto cpuset instead of re-creating it on demand
The automatic cpuset can be stored along with automatic nodeset and it does not have to be recreated when used.
This commit is contained in:
parent
84a84bd59f
commit
c9f9fa25d3
@ -642,8 +642,7 @@ qemuSetupCpusetMems(virDomainObjPtr vm)
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemuSetupCpusetCgroup(virDomainObjPtr vm,
|
qemuSetupCpusetCgroup(virDomainObjPtr vm)
|
||||||
virCapsPtr caps)
|
|
||||||
{
|
{
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
char *cpu_mask = NULL;
|
char *cpu_mask = NULL;
|
||||||
@ -658,15 +657,10 @@ qemuSetupCpusetCgroup(virDomainObjPtr vm,
|
|||||||
if (vm->def->cpumask ||
|
if (vm->def->cpumask ||
|
||||||
(vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO)) {
|
(vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO)) {
|
||||||
|
|
||||||
if (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) {
|
if (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO)
|
||||||
virBitmapPtr cpumap;
|
cpu_mask = virBitmapFormat(priv->autoCpuset);
|
||||||
if (!(cpumap = virCapabilitiesGetCpusForNodemask(caps, priv->autoNodeset)))
|
else
|
||||||
goto cleanup;
|
|
||||||
cpu_mask = virBitmapFormat(cpumap);
|
|
||||||
virBitmapFree(cpumap);
|
|
||||||
} else {
|
|
||||||
cpu_mask = virBitmapFormat(vm->def->cpumask);
|
cpu_mask = virBitmapFormat(vm->def->cpumask);
|
||||||
}
|
|
||||||
|
|
||||||
if (!cpu_mask)
|
if (!cpu_mask)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -896,7 +890,6 @@ qemuSetupCgroup(virQEMUDriverPtr driver,
|
|||||||
int *nicindexes)
|
int *nicindexes)
|
||||||
{
|
{
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
virCapsPtr caps = NULL;
|
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if (!vm->pid) {
|
if (!vm->pid) {
|
||||||
@ -911,9 +904,6 @@ qemuSetupCgroup(virQEMUDriverPtr driver,
|
|||||||
if (!priv->cgroup)
|
if (!priv->cgroup)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (qemuSetupDevicesCgroup(driver, vm) < 0)
|
if (qemuSetupDevicesCgroup(driver, vm) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -926,12 +916,11 @@ qemuSetupCgroup(virQEMUDriverPtr driver,
|
|||||||
if (qemuSetupCpuCgroup(driver, vm) < 0)
|
if (qemuSetupCpuCgroup(driver, vm) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (qemuSetupCpusetCgroup(vm, caps) < 0)
|
if (qemuSetupCpusetCgroup(vm) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
virObjectUnref(caps);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -458,6 +458,7 @@ qemuDomainObjPrivateFree(void *data)
|
|||||||
}
|
}
|
||||||
VIR_FREE(priv->cleanupCallbacks);
|
VIR_FREE(priv->cleanupCallbacks);
|
||||||
virBitmapFree(priv->autoNodeset);
|
virBitmapFree(priv->autoNodeset);
|
||||||
|
virBitmapFree(priv->autoCpuset);
|
||||||
VIR_FREE(priv);
|
VIR_FREE(priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +191,10 @@ struct _qemuDomainObjPrivate {
|
|||||||
char **qemuDevices; /* NULL-terminated list of devices aliases known to QEMU */
|
char **qemuDevices; /* NULL-terminated list of devices aliases known to QEMU */
|
||||||
|
|
||||||
bool hookRun; /* true if there was a hook run over this domain */
|
bool hookRun; /* true if there was a hook run over this domain */
|
||||||
|
|
||||||
|
/* Bitmaps below hold data from the auto NUMA feature */
|
||||||
virBitmapPtr autoNodeset;
|
virBitmapPtr autoNodeset;
|
||||||
|
virBitmapPtr autoCpuset;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -4333,7 +4333,6 @@ int qemuProcessStart(virConnectPtr conn,
|
|||||||
size_t i;
|
size_t i;
|
||||||
bool rawio_set = false;
|
bool rawio_set = false;
|
||||||
char *nodeset = NULL;
|
char *nodeset = NULL;
|
||||||
virBitmapPtr nodemask = NULL;
|
|
||||||
unsigned int stop_flags;
|
unsigned int stop_flags;
|
||||||
virQEMUDriverConfigPtr cfg;
|
virQEMUDriverConfigPtr cfg;
|
||||||
virCapsPtr caps = NULL;
|
virCapsPtr caps = NULL;
|
||||||
@ -4594,10 +4593,14 @@ int qemuProcessStart(virConnectPtr conn,
|
|||||||
|
|
||||||
VIR_DEBUG("Nodeset returned from numad: %s", nodeset);
|
VIR_DEBUG("Nodeset returned from numad: %s", nodeset);
|
||||||
|
|
||||||
if (virBitmapParse(nodeset, 0, &nodemask, VIR_DOMAIN_CPUMASK_LEN) < 0)
|
if (virBitmapParse(nodeset, 0, &priv->autoNodeset,
|
||||||
|
VIR_DOMAIN_CPUMASK_LEN) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (!(priv->autoCpuset = virCapabilitiesGetCpusForNodemask(caps,
|
||||||
|
priv->autoNodeset)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
priv->autoNodeset = nodemask;
|
|
||||||
|
|
||||||
/* "volume" type disk's source must be translated before
|
/* "volume" type disk's source must be translated before
|
||||||
* cgroup and security setting.
|
* cgroup and security setting.
|
||||||
@ -4664,7 +4667,7 @@ int qemuProcessStart(virConnectPtr conn,
|
|||||||
migrateFrom, stdin_fd, snapshot, vmop,
|
migrateFrom, stdin_fd, snapshot, vmop,
|
||||||
&buildCommandLineCallbacks, false,
|
&buildCommandLineCallbacks, false,
|
||||||
qemuCheckFips(),
|
qemuCheckFips(),
|
||||||
nodemask,
|
priv->autoNodeset,
|
||||||
&nnicindexes, &nicindexes)))
|
&nnicindexes, &nicindexes)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user