On Tue, Aug 21, 2018 at 04:10:27PM +0800, guangrong.xiao@xxxxxxxxx wrote: > From: Xiao Guangrong <xiaoguangrong@xxxxxxxxxxx> > > As Peter pointed out: > | - xbzrle_counters.cache_miss is done in save_xbzrle_page(), so it's > | per-guest-page granularity > | > | - RAMState.iterations is done for each ram_find_and_save_block(), so > | it's per-host-page granularity > | > | An example is that when we migrate a 2M huge page in the guest, we > | will only increase the RAMState.iterations by 1 (since > | ram_find_and_save_block() will be called once), but we might increase > | xbzrle_counters.cache_miss for 2M/4K=512 times (we'll call > | save_xbzrle_page() that many times) if all the pages got cache miss. > | Then IMHO the cache miss rate will be 512/1=51200% (while it should > | actually be just 100% cache miss). > > And he also suggested as xbzrle_counters.cache_miss_rate is the only > user of rs->iterations we can adapt it to count target guest page > numbers > > After that, rename 'iterations' to 'target_page_count' to better reflect > its meaning > > Suggested-by: Peter Xu <peterx@xxxxxxxxxx> > Signed-off-by: Xiao Guangrong <xiaoguangrong@xxxxxxxxxxx> Reviewed-by: Peter Xu <peterx@xxxxxxxxxx> Thanks, -- Peter Xu