"Dr. David Alan Gilbert" <dgilb...@redhat.com> wrote:
> * Juan Quintela (quint...@redhat.com) wrote:
>> So we use multifd to transmit zero pages.
>> 
>> Signed-off-by: Juan Quintela <quint...@redhat.com>
>> ---
>>  migration/ram.c | 32 +++++++++++++++++++++++++++++++-
>>  1 file changed, 31 insertions(+), 1 deletion(-)
>> 
>> diff --git a/migration/ram.c b/migration/ram.c
>> index 3536778e19..bdc7cec4cd 100644
>> --- a/migration/ram.c
>> +++ b/migration/ram.c
>> @@ -2168,6 +2168,32 @@ static int ram_save_target_page_legacy(RAMState *rs, 
>> PageSearchStatus *pss)
>>      return ram_save_page(rs, pss);
>>  }
>>  
>> +/**
>> + * ram_save_target_page_multifd: save one target page
>> + *
>> + * Returns the number of pages written
>> + *
>> + * @rs: current RAM state
>> + * @pss: data about the page we want to send
>> + */
>> +static int ram_save_target_page_multifd(RAMState *rs, PageSearchStatus *pss)
>> +{
>> +    RAMBlock *block = pss->block;
>> +    ram_addr_t offset = ((ram_addr_t)pss->page) << TARGET_PAGE_BITS;
>> +    int res;
>> +
>> +    if (!migration_in_postcopy()) {
>> +        return ram_save_multifd_page(rs, block, offset);
>> +    }
>> +
>> +    res = save_zero_page(rs, block, offset);
>
> I'm confused; I think I was expecting to see in this patch, the one that
> would check the parameter you added and do something different - where
> did that go?
>
> Note I think this is quite subtle that the difference here is really
> just the ordering rather than adding a zero page test.

Hi dave

you are right.  Too much rebasing.


>> +    if (res > 0) {
>> +        return res;
>> +    }
>> +
>> +    return ram_save_page(rs, pss);
>> +}
>> +
>>  /**
>>   * ram_save_host_page: save a whole host page
>>   *
>> @@ -3011,7 +3037,11 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
>>      ram_control_before_iterate(f, RAM_CONTROL_SETUP);
>>      ram_control_after_iterate(f, RAM_CONTROL_SETUP);
>>  
>> -    (*rsp)->ram_save_target_page = ram_save_target_page_legacy;
>> +    if (migrate_use_multifd()) {
>> +        (*rsp)->ram_save_target_page = ram_save_target_page_multifd;
>> +    } else {
>> +        (*rsp)->ram_save_target_page = ram_save_target_page_legacy;
>> +    }

I need to add the check here.

Good catch, Juan.

>>      multifd_send_sync_main(f);
>>      qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
>>      qemu_fflush(f);
>> -- 
>> 2.34.1
>> 


Reply via email to