|
|
6ae9ed |
From abf332e0e9be7f8220bda459ad100aa4f0bb9ff6 Mon Sep 17 00:00:00 2001
|
|
|
6ae9ed |
Message-Id: <abf332e0e9be7f8220bda459ad100aa4f0bb9ff6@dist-git>
|
|
|
6ae9ed |
From: Martin Kletzander <mkletzan@redhat.com>
|
|
|
6ae9ed |
Date: Wed, 24 Aug 2016 16:10:55 -0400
|
|
|
6ae9ed |
Subject: [PATCH] qemu: Use qemuProcessSetupPid() in qemuProcessSetupEmulator()
|
|
|
6ae9ed |
|
|
|
6ae9ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1097930
|
|
|
6ae9ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1224341
|
|
|
6ae9ed |
|
|
|
6ae9ed |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
6ae9ed |
(cherry picked from commit d65534f3ecba3dc2f99940eae75fa5cb01c59efc)
|
|
|
6ae9ed |
---
|
|
|
6ae9ed |
src/qemu/qemu_process.c | 69 ++++---------------------------------------------
|
|
|
6ae9ed |
1 file changed, 5 insertions(+), 64 deletions(-)
|
|
|
6ae9ed |
|
|
|
6ae9ed |
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
|
|
6ae9ed |
index 64b1ac9..de34851 100644
|
|
|
6ae9ed |
--- a/src/qemu/qemu_process.c
|
|
|
6ae9ed |
+++ b/src/qemu/qemu_process.c
|
|
|
6ae9ed |
@@ -2415,70 +2415,11 @@ qemuProcessSetupPid(virDomainObjPtr vm,
|
|
|
6ae9ed |
static int
|
|
|
6ae9ed |
qemuProcessSetupEmulator(virDomainObjPtr vm)
|
|
|
6ae9ed |
{
|
|
|
6ae9ed |
- virBitmapPtr cpumask = NULL;
|
|
|
6ae9ed |
- virCgroupPtr cgroup_emulator = NULL;
|
|
|
6ae9ed |
- qemuDomainObjPrivatePtr priv = vm->privateData;
|
|
|
6ae9ed |
- unsigned long long period = vm->def->cputune.emulator_period;
|
|
|
6ae9ed |
- long long quota = vm->def->cputune.emulator_quota;
|
|
|
6ae9ed |
- int ret = -1;
|
|
|
6ae9ed |
-
|
|
|
6ae9ed |
- if ((period || quota) &&
|
|
|
6ae9ed |
- !virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPU)) {
|
|
|
6ae9ed |
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
|
6ae9ed |
- _("cgroup cpu is required for scheduler tuning"));
|
|
|
6ae9ed |
- return -1;
|
|
|
6ae9ed |
- }
|
|
|
6ae9ed |
-
|
|
|
6ae9ed |
- if (vm->def->cputune.emulatorpin)
|
|
|
6ae9ed |
- cpumask = vm->def->cputune.emulatorpin;
|
|
|
6ae9ed |
- else if (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO &&
|
|
|
6ae9ed |
- priv->autoCpuset)
|
|
|
6ae9ed |
- cpumask = priv->autoCpuset;
|
|
|
6ae9ed |
- else
|
|
|
6ae9ed |
- cpumask = vm->def->cpumask;
|
|
|
6ae9ed |
-
|
|
|
6ae9ed |
- /* If CPU cgroup controller is not initialized here, then we need
|
|
|
6ae9ed |
- * neither period nor quota settings. And if CPUSET controller is
|
|
|
6ae9ed |
- * not initialized either, then there's nothing to do anyway. */
|
|
|
6ae9ed |
- if (virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPU) ||
|
|
|
6ae9ed |
- virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET)) {
|
|
|
6ae9ed |
-
|
|
|
6ae9ed |
- if (virCgroupNewThread(priv->cgroup, VIR_CGROUP_THREAD_EMULATOR, 0,
|
|
|
6ae9ed |
- true, &cgroup_emulator) < 0)
|
|
|
6ae9ed |
- goto cleanup;
|
|
|
6ae9ed |
-
|
|
|
6ae9ed |
- if (virCgroupAddTask(cgroup_emulator, vm->pid) < 0)
|
|
|
6ae9ed |
- goto cleanup;
|
|
|
6ae9ed |
-
|
|
|
6ae9ed |
-
|
|
|
6ae9ed |
- if (cpumask) {
|
|
|
6ae9ed |
- if (virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET) &&
|
|
|
6ae9ed |
- qemuSetupCgroupCpusetCpus(cgroup_emulator, cpumask) < 0)
|
|
|
6ae9ed |
- goto cleanup;
|
|
|
6ae9ed |
- }
|
|
|
6ae9ed |
-
|
|
|
6ae9ed |
- if (period || quota) {
|
|
|
6ae9ed |
- if (virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPU) &&
|
|
|
6ae9ed |
- qemuSetupCgroupVcpuBW(cgroup_emulator, period,
|
|
|
6ae9ed |
- quota) < 0)
|
|
|
6ae9ed |
- goto cleanup;
|
|
|
6ae9ed |
- }
|
|
|
6ae9ed |
- }
|
|
|
6ae9ed |
-
|
|
|
6ae9ed |
- if (cpumask &&
|
|
|
6ae9ed |
- virProcessSetAffinity(vm->pid, cpumask) < 0)
|
|
|
6ae9ed |
- goto cleanup;
|
|
|
6ae9ed |
-
|
|
|
6ae9ed |
- ret = 0;
|
|
|
6ae9ed |
-
|
|
|
6ae9ed |
- cleanup:
|
|
|
6ae9ed |
- if (cgroup_emulator) {
|
|
|
6ae9ed |
- if (ret < 0)
|
|
|
6ae9ed |
- virCgroupRemove(cgroup_emulator);
|
|
|
6ae9ed |
- virCgroupFree(&cgroup_emulator);
|
|
|
6ae9ed |
- }
|
|
|
6ae9ed |
-
|
|
|
6ae9ed |
- return ret;
|
|
|
6ae9ed |
+ return qemuProcessSetupPid(vm, vm->pid, VIR_CGROUP_THREAD_EMULATOR,
|
|
|
6ae9ed |
+ 0, vm->def->cputune.emulatorpin,
|
|
|
6ae9ed |
+ vm->def->cputune.emulator_period,
|
|
|
6ae9ed |
+ vm->def->cputune.emulator_quota,
|
|
|
6ae9ed |
+ NULL);
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
|
|
|
6ae9ed |
|
|
|
6ae9ed |
--
|
|
|
6ae9ed |
2.10.0
|
|
|
6ae9ed |
|