qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v7 10/12] multifd: Support for zero pages transmission


From: Juan Quintela
Subject: Re: [PATCH v7 10/12] multifd: Support for zero pages transmission
Date: Mon, 14 Nov 2022 13:09:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux)

Leonardo Brás <leobras@redhat.com> wrote:

...

>> @@ -712,6 +726,7 @@ static void *multifd_send_thread(void *opaque)
>>              qemu_mutex_lock(&p->mutex);
>>              p->num_packets++;
>>              p->total_normal_pages += p->normal_num;
>> +            p->total_zero_pages += p->zero_num;
>
> I can see it getting declared, incremented and used. But where is it 
> initialized
> in zero? I mean, should it not have 'p->total_normal_pages = 0;' somewhere in
> setup?

int multifd_save_setup(Error **errp)
{
    ....

    thread_count = migrate_multifd_channels();
    multifd_send_state = g_malloc0(sizeof(*multifd_send_state));
    multifd_send_state->params = g_new0(MultiFDSendParams, thread_count);

You can see here, that we setup everything to zero.  We only need to
initialize explicitely whatever is not zero.


> (I understand multifd_save_setup() allocates a multifd_send_state->params with
> g_new0(),but other variables are zeroed there, like p->pending_job and 
> p->write_flags, so why not?)   

Humm, I think that it is better to do it the other way around.  Remove
the initilazations that are not zero.  That way we only put whatever is
not zero.


Thanks, Juan.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]