On Tue, Aug 21, 2018 at 04:10:26PM +0800, guangrong.x...@gmail.com wrote:
> From: Xiao Guangrong <xiaoguangr...@tencent.com>
> 
> flush_compressed_data() needs to wait all compression threads to
> finish their work, after that all threads are free until the
> migration feeds new request to them, reducing its call can improve
> the throughput and use CPU resource more effectively
> 
> We do not need to flush all threads at the end of iteration, the
> data can be kept locally until the memory block is changed or
> memory migration starts over in that case we will meet a dirtied
> page which may still exists in compression threads's ring

You forgot to remove the line in ram_save_iterate(), didn't you? :)

> 
> Signed-off-by: Xiao Guangrong <xiaoguangr...@tencent.com>
> ---
>  migration/ram.c | 90 
> +++++++++++++++++++++++++++++++--------------------------
>  1 file changed, 49 insertions(+), 41 deletions(-)
> 
> diff --git a/migration/ram.c b/migration/ram.c
> index 99ecf9b315..1d54285501 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -1602,6 +1602,47 @@ static void migration_update_rates(RAMState *rs, 
> int64_t end_time)
>      }
>  }
>  
> +static void
> +update_compress_thread_counts(const CompressParam *param, int bytes_xmit)
> +{
> +    if (param->zero_page) {
> +        ram_counters.duplicate++;
> +    }
> +    ram_counters.transferred += bytes_xmit;
> +}
> +
> +static void flush_compressed_data(RAMState *rs)

If no content change in these two functions I would rather just
declare flush_compressed_data() at the beginning of the file which is
oneliner.  What do you think?

Regards,

-- 
Peter Xu

Reply via email to