summary refs log tree commit diff stats
path: root/migration/multifd-zero-page.c
diff options
context:
space:
mode:
authorFabiano Rosas <farosas@suse.de>2024-08-27 14:45:55 -0300
committerFabiano Rosas <farosas@suse.de>2024-09-03 16:24:35 -0300
commit5aff71767c7c695fce2975a6bc020b23d173cdcd (patch)
tree5398bcd9fee0846b79b003090fe1f66711f827d9 /migration/multifd-zero-page.c
parent9f0e10890109601f375b687736b65e8fac734b55 (diff)
downloadfocaccia-qemu-5aff71767c7c695fce2975a6bc020b23d173cdcd.tar.gz
focaccia-qemu-5aff71767c7c695fce2975a6bc020b23d173cdcd.zip
migration/multifd: Move pages accounting into multifd_send_zero_page_detect()
All references to pages are being removed from the multifd worker
threads in order to allow multifd to deal with different payload
types.

multifd_send_zero_page_detect() is called by all multifd migration
paths that deal with pages and is the last spot where zero pages and
normal page amounts are adjusted. Move the pages accounting into that
function.

Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Diffstat (limited to 'migration/multifd-zero-page.c')
-rw-r--r--migration/multifd-zero-page.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/migration/multifd-zero-page.c b/migration/multifd-zero-page.c
index 6506a4aa89..f1e988a959 100644
--- a/migration/multifd-zero-page.c
+++ b/migration/multifd-zero-page.c
@@ -14,6 +14,7 @@
 #include "qemu/cutils.h"
 #include "exec/ramblock.h"
 #include "migration.h"
+#include "migration-stats.h"
 #include "multifd.h"
 #include "options.h"
 #include "ram.h"
@@ -53,7 +54,7 @@ void multifd_send_zero_page_detect(MultiFDSendParams *p)
 
     if (!multifd_zero_page_enabled()) {
         pages->normal_num = pages->num;
-        return;
+        goto out;
     }
 
     /*
@@ -74,6 +75,10 @@ void multifd_send_zero_page_detect(MultiFDSendParams *p)
     }
 
     pages->normal_num = i;
+
+out:
+    stat64_add(&mig_stats.normal_pages, pages->normal_num);
+    stat64_add(&mig_stats.zero_pages, pages->num - pages->normal_num);
 }
 
 void multifd_recv_zero_page_process(MultiFDRecvParams *p)