[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 09/16] postcopy: Load huge pages in one go
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[Qemu-devel] [PATCH v3 09/16] postcopy: Load huge pages in one go |
Date: |
Fri, 24 Feb 2017 18:28:37 +0000 |
From: "Dr. David Alan Gilbert" <address@hidden>
The existing postcopy RAM load loop already ensures that it
glues together whole host-pages from the target page size chunks sent
over the wire. Modify the definition of host page that it uses
to be the RAM block page size and thus be huge pages where appropriate.
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
Reviewed-by: Laurent Vivier <address@hidden>
---
migration/ram.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index ff86664..9f28da2 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -2390,7 +2390,7 @@ static int ram_load_postcopy(QEMUFile *f)
{
int flags = 0, ret = 0;
bool place_needed = false;
- bool matching_page_sizes = qemu_host_page_size == TARGET_PAGE_SIZE;
+ bool matching_page_sizes = false;
MigrationIncomingState *mis = migration_incoming_get_current();
/* Temporary page that is later 'placed' */
void *postcopy_host_page = postcopy_get_tmp_page(mis);
@@ -2420,8 +2420,11 @@ static int ram_load_postcopy(QEMUFile *f)
ret = -EINVAL;
break;
}
+ matching_page_sizes = block->page_size == TARGET_PAGE_SIZE;
/*
- * Postcopy requires that we place whole host pages atomically.
+ * Postcopy requires that we place whole host pages atomically;
+ * these may be huge pages for RAMBlocks that are backed by
+ * hugetlbfs.
* To make it atomic, the data is read into a temporary page
* that's moved into place later.
* The migration protocol uses, possibly smaller, target-pages
@@ -2429,9 +2432,9 @@ static int ram_load_postcopy(QEMUFile *f)
* of a host page in order.
*/
page_buffer = postcopy_host_page +
- ((uintptr_t)host & ~qemu_host_page_mask);
+ ((uintptr_t)host & (block->page_size - 1));
/* If all TP are zero then we can optimise the place */
- if (!((uintptr_t)host & ~qemu_host_page_mask)) {
+ if (!((uintptr_t)host & (block->page_size - 1))) {
all_zero = true;
} else {
/* not the 1st TP within the HP */
@@ -2449,7 +2452,7 @@ static int ram_load_postcopy(QEMUFile *f)
* page
*/
place_needed = (((uintptr_t)host + TARGET_PAGE_SIZE) &
- ~qemu_host_page_mask) == 0;
+ (block->page_size - 1)) == 0;
place_source = postcopy_host_page;
}
last_host = host;
--
2.9.3
- [Qemu-devel] [PATCH v3 02/16] postcopy: Transmit and compare individual page sizes, (continued)
- [Qemu-devel] [PATCH v3 02/16] postcopy: Transmit and compare individual page sizes, Dr. David Alan Gilbert (git), 2017/02/24
- [Qemu-devel] [PATCH v3 01/16] postcopy: Transmit ram size summary word, Dr. David Alan Gilbert (git), 2017/02/24
- [Qemu-devel] [PATCH v3 03/16] postcopy: Chunk discards for hugepages, Dr. David Alan Gilbert (git), 2017/02/24
- [Qemu-devel] [PATCH v3 04/16] exec: ram_block_discard_range, Dr. David Alan Gilbert (git), 2017/02/24
- [Qemu-devel] [PATCH v3 06/16] postcopy: Record largest page size, Dr. David Alan Gilbert (git), 2017/02/24
- [Qemu-devel] [PATCH v3 08/16] postcopy: Use temporary for placing zero huge pages, Dr. David Alan Gilbert (git), 2017/02/24
- [Qemu-devel] [PATCH v3 05/16] postcopy: enhance ram_block_discard_range for hugepages, Dr. David Alan Gilbert (git), 2017/02/24
- [Qemu-devel] [PATCH v3 07/16] postcopy: Plumb pagesize down into place helpers, Dr. David Alan Gilbert (git), 2017/02/24
- [Qemu-devel] [PATCH v3 10/16] postcopy: Mask fault addresses to huge page boundary, Dr. David Alan Gilbert (git), 2017/02/24
- [Qemu-devel] [PATCH v3 09/16] postcopy: Load huge pages in one go,
Dr. David Alan Gilbert (git) <=
- [Qemu-devel] [PATCH v3 12/16] postcopy: Allow hugepages, Dr. David Alan Gilbert (git), 2017/02/24
- [Qemu-devel] [PATCH v3 11/16] postcopy: Send whole huge pages, Dr. David Alan Gilbert (git), 2017/02/24
- [Qemu-devel] [PATCH v3 14/16] postcopy: Check for userfault+hugepage feature, Dr. David Alan Gilbert (git), 2017/02/24
- [Qemu-devel] [PATCH v3 13/16] postcopy: Update userfaultfd.h header, Dr. David Alan Gilbert (git), 2017/02/24
- [Qemu-devel] [PATCH v3 15/16] postcopy: Add doc about hugepages and postcopy, Dr. David Alan Gilbert (git), 2017/02/24
- [Qemu-devel] [PATCH v3 16/16] postcopy: Add extra check for COPY function, Dr. David Alan Gilbert (git), 2017/02/24