]> git.proxmox.com Git - mirror_qemu.git/commit
accel: kvm: Fix memory waste under mismatch page size
authorKeqian Zhu <zhukeqian1@huawei.com>
Thu, 17 Dec 2020 01:49:40 +0000 (09:49 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 6 Mar 2021 10:41:54 +0000 (11:41 +0100)
commite0a8f99355c32b48c9ef867127075b5267ae23d8
tree3c750b728cdffacbaca86499a77b8848d578f4d9
parent10b6ee1616f984c1889d0851226a9ff14b35ac58
accel: kvm: Fix memory waste under mismatch page size

When handle dirty log, we face qemu_real_host_page_size and
TARGET_PAGE_SIZE. The first one is the granule of KVM dirty
bitmap, and the second one is the granule of QEMU dirty bitmap.

As qemu_real_host_page_size >= TARGET_PAGE_SIZE (kvm_init()
enforced it), misuse TARGET_PAGE_SIZE to init kvmslot dirty_bmap
may waste memory. For example, when qemu_real_host_page_size is
64K and TARGET_PAGE_SIZE is 4K, it wastes 93.75% (15/16) memory.

Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <20201217014941.22872-2-zhukeqian1@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
accel/kvm/kvm-all.c