The dirty and non-dirty pages are checked one by one. When most of the memory is not dirty, checking the dirty and non-dirty pages by multiple page size should be much faster than checking them one by one. We introduced bit-based phys_ram_dirty for VGA, CODE, MIGRATION, MASTER, and cpu_physical_memory_get_dirty_range() for this purpose. The following numbers show the speed up of bit-based phys_ram_dirty. The speed up grows when the number of rows, whose contents are 0, gets larger.
Test Environment: CPU: 4x Intel Xeon Quad Core 2.66GHz Mem size: 96GB Host OS: CentOS (kernel 2.6.33) Guest OS: Debian/GNU Linux lenny (kernel 2.6.26) Guest Mem size: 512MB Conditions of experiments are as follows: Cond1: Guest OS periodically makes the 256MB continuous dirty pages. Cond2: Guest OS periodically makes the 256MB dirty pages and non-dirty pages in turn. Cond3: Guest OS read 1GB file, which is bigger than memory. Cond4: Guest OS write 1GB file, which is bigger than memory. Experimental results: Cond1: 5 ??? 83 times speed up Cond2: 5 ??? 52 times speed up Cond3: 5 ??? 132 times speed up Cond4: 5 ??? 57 times speed up Changes from v4 to v5 are: - Rebased to HEAD (2b644fd0e737407133c88054ba498e772ce01f27) - Use BITMAP_SIZE() in kvm_physical_sync_dirty_bitmap() (3/4) Changes from v3 to v4 are: - Merged {1,2,3}/6 to compile correctly. - Fix setting bits after phys_ram_dirty allocation. - renamed DIRTY_FLAG and DIRTY_IDX converter function. Changes from v2 to v3 are: - Change FLAGS value to (1,2,4,8), and add IDX (0,1,2,3) - Use ffs to convert FLAGS to IDX. - Add a helper function which takes IDX. - Change the behavior of MASTER as a buffer. - Change dirty bitmap access to a loop. - Add brace after if () Yoshiaki Tamura (4): Modify DIRTY_FLAG value and introduce DIRTY_IDX to use as indexes of bit-based phys_ram_dirty. Introduce cpu_physical_memory_get_dirty_range(). Use cpu_physical_memory_set_dirty_range() to update phys_ram_dirty. Use cpu_physical_memory_get_dirty_range() to check multiple dirty pages. arch_init.c | 54 ++++++++++++++--------- cpu-all.h | 132 ++++++++++++++++++++++++++++++++++++++++++++++++--------- exec.c | 82 +++++++++++++++++++++++++++++++++-- kvm-all.c | 24 ++++------ qemu-common.h | 3 + 5 files changed, 234 insertions(+), 61 deletions(-)