]> git.proxmox.com Git - mirror_qemu.git/commit
Change the method to calculate dirty-pages-rate
authorChao Fan <fanc.fnst@cn.fujitsu.com>
Tue, 14 Mar 2017 01:55:07 +0000 (09:55 +0800)
committerJuan Quintela <quintela@redhat.com>
Thu, 16 Mar 2017 07:55:56 +0000 (08:55 +0100)
commit1ffb5dfd35888cd9de78cc97d3e3e3cb1f3c4887
tree17af5040ece1efd2a522516066a5c8591b35e26e
parent1883ff34b540daacae948f493b0ba525edf5f642
Change the method to calculate dirty-pages-rate

In function cpu_physical_memory_sync_dirty_bitmap, file
include/exec/ram_addr.h:

if (src[idx][offset]) {
    unsigned long bits = atomic_xchg(&src[idx][offset], 0);
    unsigned long new_dirty;
    new_dirty = ~dest[k];
    dest[k] |= bits;
    new_dirty &= bits;
    num_dirty += ctpopl(new_dirty);
}

After these codes executed, only the pages not dirtied in bitmap(dest),
but dirtied in dirty_memory[DIRTY_MEMORY_MIGRATION] will be calculated.
For example:
When ram_list.dirty_memory[DIRTY_MEMORY_MIGRATION] = 0b00001111,
and atomic_rcu_read(&migration_bitmap_rcu)->bmap = 0b00000011,
the new_dirty will be 0b00001100, and this function will return 2 but not
4 which is expected.
the dirty pages in dirty_memory[DIRTY_MEMORY_MIGRATION] are all new,
so these should be calculated also.

Signed-off-by: Chao Fan <fanc.fnst@cn.fujitsu.com>
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
include/exec/ram_addr.h
migration/ram.c