[libvirt] [PATCH] Fix initial VCPU pinning in qemu driver
Daniel P. Berrange
berrange at redhat.com
Wed Apr 21 13:05:14 UTC 2010
On Wed, Apr 21, 2010 at 09:56:09AM +0200, Jiri Denemark wrote:
> First, inital VCPU pinning is set correctly but then it is reset by
> assigning qemu process to a new cgroup (which contains all CPUs). It's
> easily fixed by swapping these two actions.
> ---
> src/qemu/qemu_driver.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> Originally, I thought it would be better to change the initial pinning
> at cgroup level but then I realized it was not a good idea. AFAIK cgroup
> olny works for processes and is not usable for per-VCPU pinning. That
> is, it is fine to have all CPUs in cgroup and fine tune VCPU pinning by
> setting procss affinity.
>
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 5f4adfd..cc3e3b2 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -3081,10 +3081,10 @@ static int qemudSecurityHook(void *data) {
> /* This must take place before exec(), so that all QEMU
> * memory allocation is on the correct NUMA node
> */
> - if (qemudInitCpuAffinity(h->vm) < 0)
> + if (qemuAddToCgroup(h->driver, h->vm->def) < 0)
> return -1;
>
> - if (qemuAddToCgroup(h->driver, h->vm->def) < 0)
> + if (qemudInitCpuAffinity(h->vm) < 0)
> return -1;
>
> if (h->driver->securityDriver &&
ACK, but can you add a comment in the code too, that the cpuaffinity
setup must come after the cgroup placement.
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
More information about the libvir-list
mailing list