From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH 05/12] migration: show the statistics of compression Date: Wed, 18 Jul 2018 16:51:46 +0800 Message-ID: <2e9a96cc-4d94-1081-15cb-f307175fa6d7@gmail.com> References: <20180604095520.8563-1-xiaoguangrong@tencent.com> <20180604095520.8563-6-xiaoguangrong@tencent.com> <20180613162508.GM2676@work-vm> <20180716190122.GE2664@work-vm> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Cc: kvm@vger.kernel.org, mst@redhat.com, mtosatti@redhat.com, Xiao Guangrong , qemu-devel@nongnu.org, peterx@redhat.com, wei.w.wang@intel.com, jiang.biao2@zte.com.cn, pbonzini@redhat.com To: "Dr. David Alan Gilbert" Return-path: In-Reply-To: <20180716190122.GE2664@work-vm> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel2=m.gmane.org@nongnu.org Sender: "Qemu-devel" List-Id: kvm.vger.kernel.org On 07/17/2018 03:01 AM, Dr. David Alan Gilbert wrote: > * Xiao Guangrong (guangrong.xiao@gmail.com) wrote: >> >> >> On 06/14/2018 12:25 AM, Dr. David Alan Gilbert wrote: >> } >>>> static void migration_bitmap_sync(RAMState *rs) >>>> @@ -1412,6 +1441,9 @@ static void flush_compressed_data(RAMState *rs) >>>> qemu_mutex_lock(&comp_param[idx].mutex); >>>> if (!comp_param[idx].quit) { >>>> len = qemu_put_qemu_file(rs->f, comp_param[idx].file); >>>> + /* 8 means a header with RAM_SAVE_FLAG_CONTINUE. */ >>>> + compression_counters.reduced_size += TARGET_PAGE_SIZE - len + 8; >>> >>> I think I'd rather save just len+8 rather than than the subtraction. >>> >> Hmmmmmm, is this what you want? >> compression_counters.reduced_size += len - 8; >> >> Then calculate the real reduced size in populate_ram_info() where we return this >> info to the user: >> info->compression->reduced_size = compression_counters.pages * PAGE_SIZE - compression_counters.reduced_size; >> >> Right? > > I mean I'd rather see the actual size presented to the user rather than > the saving compared to uncompressed. > These statistics are used to help people to see whether compression works efficiently or not, so maybe reduced-size is more straightforward? :)