[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/15] migration: simplify check to use qemu file buf
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[Qemu-devel] [PULL 05/15] migration: simplify check to use qemu file buffer |
Date: |
Tue, 10 Jul 2018 16:30:06 +0100 |
From: Peter Xu <address@hidden>
Firstly, renaming the old matching_page_sizes variable to
matches_target_page_size, which suites more to what it did (it only
checks against target page size rather than multiple page sizes).
Meanwhile, simplify the check logic a bit, and enhance the comments.
Should have no functional change.
Reviewed-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
Signed-off-by: Peter Xu <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
---
migration/ram.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index 23cea47090..49068e86d3 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -3580,7 +3580,7 @@ static int ram_load_postcopy(QEMUFile *f)
{
int flags = 0, ret = 0;
bool place_needed = false;
- bool matching_page_sizes = false;
+ bool matches_target_page_size = false;
MigrationIncomingState *mis = migration_incoming_get_current();
/* Temporary page that is later 'placed' */
void *postcopy_host_page = postcopy_get_tmp_page(mis);
@@ -3620,7 +3620,7 @@ static int ram_load_postcopy(QEMUFile *f)
ret = -EINVAL;
break;
}
- matching_page_sizes = block->page_size == TARGET_PAGE_SIZE;
+ matches_target_page_size = block->page_size == TARGET_PAGE_SIZE;
/*
* Postcopy requires that we place whole host pages atomically;
* these may be huge pages for RAMBlocks that are backed by
@@ -3668,12 +3668,17 @@ static int ram_load_postcopy(QEMUFile *f)
case RAM_SAVE_FLAG_PAGE:
all_zero = false;
- if (!place_needed || !matching_page_sizes) {
+ if (!matches_target_page_size) {
+ /* For huge pages, we always use temporary buffer */
qemu_get_buffer(f, page_buffer, TARGET_PAGE_SIZE);
} else {
- /* Avoids the qemu_file copy during postcopy, which is
- * going to do a copy later; can only do it when we
- * do this read in one go (matching page sizes)
+ /*
+ * For small pages that matches target page size, we
+ * avoid the qemu_file copy. Instead we directly use
+ * the buffer of QEMUFile to place the page. Note: we
+ * cannot do any QEMUFile operation before using that
+ * buffer to make sure the buffer is valid when
+ * placing the page.
*/
qemu_get_buffer_in_place(f, (uint8_t **)&place_source,
TARGET_PAGE_SIZE);
--
2.17.1
- [Qemu-devel] [PULL 00/15] migration queue, Dr. David Alan Gilbert (git), 2018/07/10
- [Qemu-devel] [PULL 03/15] migration: unbreak postcopy recovery, Dr. David Alan Gilbert (git), 2018/07/10
- [Qemu-devel] [PULL 01/15] migration: delay postcopy paused state, Dr. David Alan Gilbert (git), 2018/07/10
- [Qemu-devel] [PULL 04/15] migration: unify incoming processing, Dr. David Alan Gilbert (git), 2018/07/10
- [Qemu-devel] [PULL 02/15] migration: move income process out of multifd, Dr. David Alan Gilbert (git), 2018/07/10
- [Qemu-devel] [PULL 05/15] migration: simplify check to use qemu file buffer,
Dr. David Alan Gilbert (git) <=
- [Qemu-devel] [PULL 06/15] migration: loosen recovery check when load vm, Dr. David Alan Gilbert (git), 2018/07/10
- [Qemu-devel] [PULL 07/15] migration: fix incorrect bitmap size calculation, Dr. David Alan Gilbert (git), 2018/07/10
- [Qemu-devel] [PULL 08/15] migration: show pause/recover state on dst host, Dr. David Alan Gilbert (git), 2018/07/10
- [Qemu-devel] [PULL 09/15] tests: introduce migrate_postcopy_* helpers, Dr. David Alan Gilbert (git), 2018/07/10
- [Qemu-devel] [PULL 11/15] tests: introduce migrate_query*() helpers, Dr. David Alan Gilbert (git), 2018/07/10
- [Qemu-devel] [PULL 12/15] tests: introduce wait_for_migration_status(), Dr. David Alan Gilbert (git), 2018/07/10
- [Qemu-devel] [PULL 10/15] tests: allow migrate() to take extra flags, Dr. David Alan Gilbert (git), 2018/07/10
- [Qemu-devel] [PULL 13/15] tests: add postcopy recovery test, Dr. David Alan Gilbert (git), 2018/07/10
- [Qemu-devel] [PULL 14/15] tests: hide stderr for postcopy recovery test, Dr. David Alan Gilbert (git), 2018/07/10
- [Qemu-devel] [PULL 15/15] migration: reorder MIG_CMD_POSTCOPY_RESUME, Dr. David Alan Gilbert (git), 2018/07/10