[libvirt] [PATCH 2/2] qemu: Migrate memory on numatune change
John Ferlan
jferlan at redhat.com
Fri Mar 20 11:15:59 UTC 2015
On 03/20/2015 04:53 AM, Martin Kletzander wrote:
> On Thu, Mar 19, 2015 at 07:30:26PM -0400, John Ferlan wrote:
>>
>>
<...snip...>
>>> @@ -792,9 +795,12 @@ static void
>>> qemuRestoreCgroupState(virDomainObjPtr vm)
>>> {
>>> char *mem_mask = NULL;
>>> + char *nodeset = NULL;
>>> int empty = -1;
>>> qemuDomainObjPrivatePtr priv = vm->privateData;
>>> + size_t i = 0;
>>> virBitmapPtr all_nodes;
>>> + virCgroupPtr cgroup_temp = NULL;
>>>
>>> if (!(all_nodes = virNumaGetHostNodeset()))
>>> goto error;
>>> @@ -809,9 +815,37 @@ qemuRestoreCgroupState(virDomainObjPtr vm)
>>
>> So this is the path for currently running guests to be adjusted on
>> livirtd restart after install, right?
>>
>>> if (virCgroupSetCpusetMems(priv->cgroup, mem_mask) < 0)
>>> goto error;
>>>
>>> + for (i = 0; i < priv->nvcpupids; i++) {
>>> + if (virCgroupNewVcpu(priv->cgroup, i, false, &cgroup_temp) <
>>> 0 ||
>>> + virCgroupSetCpusetMemoryMigrate(cgroup_temp, true) < 0 ||
>>> + virCgroupGetCpusetMems(cgroup_temp, &nodeset) < 0 ||
>>> + virCgroupSetCpusetMems(cgroup_temp, nodeset) < 0)
>>> + goto cleanup;
>>> +
>>> + virCgroupFree(&cgroup_temp);
>>> + }
>>> +
>>> + for (i = 0; i < priv->niothreadpids; i++) {
>>> + if (virCgroupNewIOThread(priv->cgroup, i, false,
>>> &cgroup_temp) < 0 ||
>>
>> cgroup iothread id's are 1..n, so I believe this should be 'i + 1'
>>
>
> Yes, once again I felt for the contraption in this. That shall not
> happen henceforth!
>
I usually use cscope in order to find all callers to help remind me
since I know my memory isn't as good as it once was...
I assume you've made the change and so that it's official this is your
ACK...
John
>> simple enough to test by adding <iothreads>2</iothreads> to your domain
>> definition and making sure this works...
>>
>
> I remember trying with <iothreads>1</iothreads>, there must have been
> no allocation as I only checked that the memory moved -- my bad.
>
>> Beyond that - seems reasonable to me
>>
>> John
More information about the libvir-list
mailing list