[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 22/23] migration: Use multifd before we check for the zero pag
|
From: |
Juan Quintela |
|
Subject: |
[PATCH v4 22/23] migration: Use multifd before we check for the zero page |
|
Date: |
Tue, 11 Jan 2022 14:00:23 +0100 |
So we use multifd to transmit zero pages.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
migration/ram.c | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/migration/ram.c b/migration/ram.c
index 3536778e19..bdc7cec4cd 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -2168,6 +2168,32 @@ static int ram_save_target_page_legacy(RAMState *rs,
PageSearchStatus *pss)
return ram_save_page(rs, pss);
}
+/**
+ * ram_save_target_page_multifd: save one target page
+ *
+ * Returns the number of pages written
+ *
+ * @rs: current RAM state
+ * @pss: data about the page we want to send
+ */
+static int ram_save_target_page_multifd(RAMState *rs, PageSearchStatus *pss)
+{
+ RAMBlock *block = pss->block;
+ ram_addr_t offset = ((ram_addr_t)pss->page) << TARGET_PAGE_BITS;
+ int res;
+
+ if (!migration_in_postcopy()) {
+ return ram_save_multifd_page(rs, block, offset);
+ }
+
+ res = save_zero_page(rs, block, offset);
+ if (res > 0) {
+ return res;
+ }
+
+ return ram_save_page(rs, pss);
+}
+
/**
* ram_save_host_page: save a whole host page
*
@@ -3011,7 +3037,11 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
ram_control_before_iterate(f, RAM_CONTROL_SETUP);
ram_control_after_iterate(f, RAM_CONTROL_SETUP);
- (*rsp)->ram_save_target_page = ram_save_target_page_legacy;
+ if (migrate_use_multifd()) {
+ (*rsp)->ram_save_target_page = ram_save_target_page_multifd;
+ } else {
+ (*rsp)->ram_save_target_page = ram_save_target_page_legacy;
+ }
multifd_send_sync_main(f);
qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
qemu_fflush(f);
--
2.34.1
- Re: [PATCH v4 07/23] multifd: Use proper maximum compression values, (continued)
- [PATCH v4 08/23] multifd: Move iov from pages to params, Juan Quintela, 2022/01/11
- [PATCH v4 06/23] migration: Move ram_release_pages() call to save_zero_page_to_file(), Juan Quintela, 2022/01/11
- [PATCH v4 11/23] multifd: Remove send_write() method, Juan Quintela, 2022/01/11
- [PATCH v4 12/23] multifd: Use a single writev on the send side, Juan Quintela, 2022/01/11
- [PATCH v4 19/23] multifd: Add property to enable/disable zero_page, Juan Quintela, 2022/01/11
- [PATCH v4 22/23] migration: Use multifd before we check for the zero page,
Juan Quintela <=
- [PATCH v4 16/23] multifd: recv side only needs the RAMBlock host address, Juan Quintela, 2022/01/11
- [PATCH v4 14/23] multifd: Use normal pages array on the send side, Juan Quintela, 2022/01/11
- [PATCH v4 15/23] multifd: Use normal pages array on the recv side, Juan Quintela, 2022/01/11
- [PATCH v4 18/23] migration: Make ram_save_target_page() a pointer, Juan Quintela, 2022/01/11
- [PATCH v4 17/23] multifd: Rename pages_used to normal_pages, Juan Quintela, 2022/01/11