be39b4cd20
We don't want to migrate memory that corresponds to discarded ranges as managed by a RamDiscardManager responsible for the mapped memory region of the RAMBlock. The content of these pages is essentially stale and without any guarantees for the VM ("logically unplugged"). Depending on the underlying memory type, even reading memory might populate memory on the source, resulting in an undesired memory consumption. Of course, on the destination, even writing a zeropage consumes memory, which we also want to avoid (similar to free page hinting). Currently, virtio-mem tries achieving that goal (not migrating "unplugged" memory that was discarded) by going via qemu_guest_free_page_hint() - but it's hackish and incomplete. For example, background snapshots still end up reading all memory, as they don't do bitmap syncs. Postcopy recovery code will re-add previously cleared bits to the dirty bitmap and migrate them. Let's consult the RamDiscardManager after setting up our dirty bitmap initially and when postcopy recovery code reinitializes it: clear corresponding bits in the dirty bitmaps (e.g., of the RAMBlock and inside KVM). It's important to fixup the dirty bitmap *after* our initial bitmap sync, such that the corresponding dirty bits in KVM are actually cleared. As colo is incompatible with discarding of RAM and inhibits it, we don't have to bother. Note: if a misbehaving guest would use discarded ranges after migration started we would still migrate that memory: however, then we already populated that memory on the migration source. Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: David Hildenbrand <david@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> |
||
---|---|---|
.. | ||
block-dirty-bitmap.c | ||
block.c | ||
block.h | ||
channel.c | ||
channel.h | ||
colo-failover.c | ||
colo.c | ||
dirtyrate.c | ||
dirtyrate.h | ||
exec.c | ||
exec.h | ||
fd.c | ||
fd.h | ||
global_state.c | ||
meson.build | ||
migration.c | ||
migration.h | ||
multifd-zlib.c | ||
multifd-zstd.c | ||
multifd.c | ||
multifd.h | ||
page_cache.c | ||
page_cache.h | ||
postcopy-ram.c | ||
postcopy-ram.h | ||
qemu-file-channel.c | ||
qemu-file-channel.h | ||
qemu-file.c | ||
qemu-file.h | ||
ram.c | ||
ram.h | ||
rdma.c | ||
rdma.h | ||
savevm.c | ||
savevm.h | ||
socket.c | ||
socket.h | ||
target.c | ||
tls.c | ||
tls.h | ||
trace-events | ||
trace.h | ||
vmstate-types.c | ||
vmstate.c | ||
xbzrle.c | ||
xbzrle.h | ||
yank_functions.c | ||
yank_functions.h |