Re: [Qemu-devel] [PATCH 6/8] migration: move calling save_zero_page to the common place

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

 



On Tue, Mar 13, 2018 at 03:57:37PM +0800, guangrong.xiao@xxxxxxxxx wrote:
> From: Xiao Guangrong <xiaoguangrong@xxxxxxxxxxx>
> 
> save_zero_page() is always our first approach to try, move it to
> the common place before calling ram_save_compressed_page
> and ram_save_page
> 
> Signed-off-by: Xiao Guangrong <xiaoguangrong@xxxxxxxxxxx>
> ---
>  migration/ram.c | 106 ++++++++++++++++++++++++++++++++------------------------
>  1 file changed, 60 insertions(+), 46 deletions(-)
> 
> diff --git a/migration/ram.c b/migration/ram.c
> index 839665d866..9627ce18e9 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -1021,15 +1021,8 @@ static int ram_save_page(RAMState *rs, PageSearchStatus *pss, bool last_stage)
>      trace_ram_save_page(block->idstr, (uint64_t)offset, p);
>  
>      XBZRLE_cache_lock();
> -    pages = save_zero_page(rs, block, offset);
> -    if (pages > 0) {
> -        /* Must let xbzrle know, otherwise a previous (now 0'd) cached
> -         * page would be stale
> -         */
> -        xbzrle_cache_zero_page(rs, current_addr);
> -        ram_release_pages(block->idstr, offset, pages);
> -    } else if (!rs->ram_bulk_stage &&
> -               !migration_in_postcopy() && migrate_use_xbzrle()) {
> +    if (!rs->ram_bulk_stage && !migration_in_postcopy() &&
> +           migrate_use_xbzrle()) {

Nit: indent problem?

[...]

> +static bool save_page_use_compression(RAMState *rs)
> +{
> +    if (!migrate_use_compression()) {
> +        return false;
> +    }
> +
> +    /*
> +     * If xbzrle is on, stop using the data compression after first
> +     * round of migration even if compression is enabled. In theory,
> +     * xbzrle can do better than compression.
> +     */
> +    if (rs->ram_bulk_stage || !migrate_use_xbzrle()) {
> +        return true;
> +    }
> +
> +    return false;
> +

Nit: remove this line?

Otherwise I'd say I like this patch... :)

Better with the nit fixed:

Reviewed-by: Peter Xu <peterx@xxxxxxxxxx>

Thanks,

-- 
Peter Xu



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux