@@ -2131,6 +2131,8 @@ static void reclaim_ramblock(RAMBlock *block)
void qemu_ram_free(RAMBlock *block)
{
+ ram_addr_t old_ram_size, new_ram_size;
+
if (!block) {
return;
}
@@ -2140,12 +2142,18 @@ void qemu_ram_free(RAMBlock *block)
}
qemu_mutex_lock_ramlist();
+
+ old_ram_size = last_ram_page();
QLIST_REMOVE_RCU(block, next);
+ new_ram_size = last_ram_page();
+ dirty_bitmap_resize(old_ram_size, new_ram_size);
+
ram_list.mru_block = NULL;
/* Write list before version */
smp_wmb();
ram_list.version++;
call_rcu(block, reclaim_ramblock, rcu);
+
qemu_mutex_unlock_ramlist();
}
Use the new "dirty_bitmap_resize" interface to reduce dirty bitmap blocks after we remove a ramblock from ramlist. Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com> --- softmmu/physmem.c | 8 ++++++++ 1 file changed, 8 insertions(+)