diff mbox series

[RFC,4/7] migration/multifd: Move pages accounting into multifd_send_zero_page_detect()

Message ID 20240620212111.29319-5-farosas@suse.de (mailing list archive)
State New, archived
Headers show
Series migration/multifd: Introduce storage slots | expand

Commit Message

Fabiano Rosas June 20, 2024, 9:21 p.m. UTC
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.

Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 migration/multifd-zero-page.c | 4 ++++
 migration/multifd.c           | 2 --
 2 files changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/migration/multifd-zero-page.c b/migration/multifd-zero-page.c
index 1ad77462a4..63a1c24ba8 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"
@@ -74,6 +75,9 @@  void multifd_send_zero_page_detect(MultiFDSendParams *p)
     }
 
     pages->normal_num = i;
+
+    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)
diff --git a/migration/multifd.c b/migration/multifd.c
index 55b31c4515..c4a952576d 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -975,8 +975,6 @@  static void *multifd_send_thread(void *opaque)
 
             stat64_add(&mig_stats.multifd_bytes,
                        p->next_packet_size + p->packet_len);
-            stat64_add(&mig_stats.normal_pages, pages->normal_num);
-            stat64_add(&mig_stats.zero_pages, pages->num - pages->normal_num);
 
             multifd_pages_reset(pages);
             p->next_packet_size = 0;