From: Fuweiwei <[email protected]>

Currently in qemu-kvm platform, the process of making an external memory 
snapshot is based on the "migration-to-file" sheme. It will use the system 
cache to speed up dumping. However, it will make external disk snapshots
afterwards, which must wait for the completion of flushing the dirty pages 
to the snapshot file. i.e. In virFileWrapperFdClose() after 
qemuMigrationToFile(),
it should wait until the libvirt_iohelper thread finishes fdatasync and exits.
During this time, the VM is paused (since it is suspended from the last 
iteration
of migration-to-file, to the completion of disk snapshots).

Assuming saving 4GB dirty memory at 200MB/s fdatasync speed, the VM will pause
for up to 20s, which is unfriendly to guests.

So I propose that it may be better to bypass caching upon external memory 
snapshot, via the VIR_DOMAIN_SAVE_BYPASS_CACHE flag. As a result, it may avoid
long-term fdatasync in libvirt_iohelper thread and achieve seemless VM suspend.

Signed-off-by: Fuweiwei <[email protected]>
---
 src/qemu/qemu_driver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2089359..f954c23 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14117,7 +14117,8 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr 
conn,
             goto cleanup;
 
         if ((ret = qemuDomainSaveMemory(driver, vm, snap->def->file,
-                                        xml, compressed, resume, 0,
+                                        xml, compressed, resume,
+                                        VIR_DOMAIN_SAVE_BYPASS_CACHE,
                                         QEMU_ASYNC_JOB_SNAPSHOT)) < 0)
             goto cleanup;
 
-- 
1.8.3.1

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to