
On 10/24/2012 12:00 PM, Osier Yang wrote:
When the cpu placement model is "auto", it sets the affinity for domain process with the advisory nodeset from numad, however, creating cgroup for the domain process (called emulator thread in some contexts) later overrides that with pinning it to all available pCPUs.
How to reproduce:
* Configure the domain with "auto" placement for <vcpu>, e.g. <vcpu placement='auto'>4</vcpu> * % virsh start dom * % cat /proc/$dompid/status
Though the emulator cgroup cause conflicts, but we can't simply prohibit creating it, as other tunables are still useful, such as "emulator_period", which is used by API virDomainSetSchedulerParameter. So this patch doesn't prohibit creating the emulator cgroup, but inherit the nodeset from numad, and reset the affinity for domain process.
* src/qemu/qemu_cgroup.h: Modify definition of qemuSetupCgroupForEmulator to accept the passed nodenet * src/qemu/qemu_cgroup.c: Set the affinity with the passed nodeset --- src/qemu/qemu_cgroup.c | 17 ++++++++++++++--- src/qemu/qemu_cgroup.h | 3 ++- src/qemu/qemu_process.c | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index db371a0..8e99c01 100644 @@ -698,6 +706,9 @@ int qemuSetupCgroupForEmulator(struct qemud_driver *driver, if (rc < 0) goto cleanup;
In case you go to the cleanup here, cpumask is not free()'d.
} + + if (def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) + virBitmapFree(cpumask);
You can free cpumap here or at the end and cleanup as well, no need for checking the placement then.
cpumask = NULL; /* sanity */ }
Martin