[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/21] migration/postcopy: map large zero page in postcopy_ram_inc
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PULL 09/21] migration/postcopy: map large zero page in postcopy_ram_incoming_setup() |
Date: |
Fri, 11 Oct 2019 20:16:34 +0100 |
From: Wei Yang <address@hidden>
postcopy_ram_incoming_setup() and postcopy_ram_incoming_cleanup() are
counterpart. It is reasonable to map/unmap large zero page in these two
functions respectively.
Signed-off-by: Wei Yang <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
---
migration/postcopy-ram.c | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 9a16f52a79..08a3ed516e 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -1144,6 +1144,22 @@ int postcopy_ram_enable_notify(MigrationIncomingState
*mis)
return -1;
}
+ /*
+ * Map large zero page when kernel can't use UFFDIO_ZEROPAGE for hugepages
+ */
+ mis->postcopy_tmp_zero_page = mmap(NULL, mis->largest_page_size,
+ PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS,
+ -1, 0);
+ if (mis->postcopy_tmp_zero_page == MAP_FAILED) {
+ int e = errno;
+ mis->postcopy_tmp_zero_page = NULL;
+ error_report("%s: Failed to map large zero page %s",
+ __func__, strerror(e));
+ return -e;
+ }
+ memset(mis->postcopy_tmp_zero_page, '\0', mis->largest_page_size);
+
/*
* Ballooning can mark pages as absent while we're postcopying
* that would cause false userfaults.
@@ -1250,23 +1266,7 @@ int postcopy_place_page_zero(MigrationIncomingState
*mis, void *host,
qemu_ram_block_host_offset(rb,
host));
} else {
- /* The kernel can't use UFFDIO_ZEROPAGE for hugepages */
- if (!mis->postcopy_tmp_zero_page) {
- mis->postcopy_tmp_zero_page = mmap(NULL, mis->largest_page_size,
- PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS,
- -1, 0);
- if (mis->postcopy_tmp_zero_page == MAP_FAILED) {
- int e = errno;
- mis->postcopy_tmp_zero_page = NULL;
- error_report("%s: %s mapping large zero page",
- __func__, strerror(e));
- return -e;
- }
- memset(mis->postcopy_tmp_zero_page, '\0', mis->largest_page_size);
- }
- return postcopy_place_page(mis, host, mis->postcopy_tmp_zero_page,
- rb);
+ return postcopy_place_page(mis, host, mis->postcopy_tmp_zero_page, rb);
}
}
--
2.23.0
- [PULL 00/21] migration queue, Dr. David Alan Gilbert (git), 2019/10/11
- [PULL 01/21] migration: use migration_is_active to represent active state, Dr. David Alan Gilbert (git), 2019/10/11
- [PULL 02/21] rcu: Add automatically released rcu_read_lock variants, Dr. David Alan Gilbert (git), 2019/10/11
- [PULL 03/21] migration: Fix missing rcu_read_unlock, Dr. David Alan Gilbert (git), 2019/10/11
- [PULL 05/21] migration: Use automatic rcu_read unlock in rdma.c, Dr. David Alan Gilbert (git), 2019/10/11
- [PULL 08/21] migration/postcopy: allocate tmp_page in setup stage, Dr. David Alan Gilbert (git), 2019/10/11
- [PULL 04/21] migration: Use automatic rcu_read unlock in ram.c, Dr. David Alan Gilbert (git), 2019/10/11
- [PULL 06/21] rcu: Use automatic rc_read unlock in core memory/exec code, Dr. David Alan Gilbert (git), 2019/10/11
- [PULL 09/21] migration/postcopy: map large zero page in postcopy_ram_incoming_setup(),
Dr. David Alan Gilbert (git) <=
- [PULL 07/21] migration: Don't try and recover return path in non-postcopy, Dr. David Alan Gilbert (git), 2019/10/11
- [PULL 11/21] migration: pass in_postcopy instead of check state again, Dr. David Alan Gilbert (git), 2019/10/11
- [PULL 10/21] migration/postcopy: fix typo in mark_postcopy_blocktime_begin's comment, Dr. David Alan Gilbert (git), 2019/10/11
- [PULL 12/21] migration: report SaveStateEntry id and name on failure, Dr. David Alan Gilbert (git), 2019/10/11
- [PULL 13/21] migration/postcopy: mis->have_listen_thread check will never be touched, Dr. David Alan Gilbert (git), 2019/10/11
- [PULL 14/21] migration/postcopy: postpone setting PostcopyState to END, Dr. David Alan Gilbert (git), 2019/10/11
- [PULL 15/21] migration/postcopy: rename postcopy_ram_enable_notify to postcopy_ram_incoming_setup, Dr. David Alan Gilbert (git), 2019/10/11
- [PULL 16/21] migration/postcopy: check PostcopyState before setting to POSTCOPY_INCOMING_RUNNING, Dr. David Alan Gilbert (git), 2019/10/11
- [PULL 17/21] migration/multifd: fix a typo in comment of multifd_recv_unfill_packet(), Dr. David Alan Gilbert (git), 2019/10/11
- [PULL 18/21] migration/multifd: use pages->allocated instead of the static max, Dr. David Alan Gilbert (git), 2019/10/11