thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
0a122b
From 325f2d5f89e8275844a08c5fd0ea0e2ebe4874ca Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <325f2d5f89e8275844a08c5fd0ea0e2ebe4874ca.1387382496.git.minovotn@redhat.com>
0a122b
In-Reply-To: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
0a122b
References: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
0a122b
From: Nigel Croxon <ncroxon@redhat.com>
0a122b
Date: Thu, 14 Nov 2013 22:53:16 +0100
0a122b
Subject: [PATCH 40/46] migration: ram_handle_compressed
0a122b
0a122b
RH-Author: Nigel Croxon <ncroxon@redhat.com>
0a122b
Message-id: <1384469598-13137-41-git-send-email-ncroxon@redhat.com>
0a122b
Patchwork-id: 55727
0a122b
O-Subject: [RHEL7.0 PATCH 40/42] migration: ram_handle_compressed
0a122b
Bugzilla: 1011720
0a122b
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
0a122b
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
0a122b
Bugzilla: 1011720
0a122b
https://bugzilla.redhat.com/show_bug.cgi?id=1011720
0a122b
0a122b
>From commit ID:
0a122b
commit d613a56f845788412a442c6b5aff88b38244f99a
0a122b
Author: Isaku Yamahata <yamahata@private.email.ne.jp>
0a122b
Date:   Sat Sep 21 01:23:37 2013 +0900
0a122b
0a122b
    migration: ram_handle_compressed
0a122b
0a122b
    ram_handle_compressed() should be aware of size > TARGET_PAGE_SIZE.
0a122b
    migration-rdma can call it with larger size.
0a122b
0a122b
    Signed-off-by: Isaku Yamahata <yamahata@private.email.ne.jp>
0a122b
    Signed-off-by: Juan Quintela <quintela@redhat.com>
0a122b
---
0a122b
 arch_init.c |   11 ++++++-----
0a122b
 1 files changed, 6 insertions(+), 5 deletions(-)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 arch_init.c | 11 ++++++-----
0a122b
 1 file changed, 6 insertions(+), 5 deletions(-)
0a122b
0a122b
diff --git a/arch_init.c b/arch_init.c
0a122b
index 5ce9c61..d71fb33 100644
0a122b
--- a/arch_init.c
0a122b
+++ b/arch_init.c
0a122b
@@ -848,13 +848,14 @@ static inline void *host_from_stream_offset(QEMUFile *f,
0a122b
  */
0a122b
 void ram_handle_compressed(void *host, uint8_t ch, uint64_t size)
0a122b
 {
0a122b
-    if (ch != 0 || !is_zero_range(host, TARGET_PAGE_SIZE)) {
0a122b
+    if (ch != 0 || !is_zero_range(host, size)) {
0a122b
         memset(host, ch, size);
0a122b
 #ifndef _WIN32
0a122b
-        if (ch == 0 &&
0a122b
-            (!kvm_enabled() || kvm_has_sync_mmu()) &&
0a122b
-            getpagesize() <= TARGET_PAGE_SIZE) {
0a122b
-            qemu_madvise(host, TARGET_PAGE_SIZE, QEMU_MADV_DONTNEED);
0a122b
+        if (ch == 0 && (!kvm_enabled() || kvm_has_sync_mmu())) {
0a122b
+            size = size & ~(getpagesize() - 1);
0a122b
+            if (size > 0) {
0a122b
+                qemu_madvise(host, size, QEMU_MADV_DONTNEED);
0a122b
+            }
0a122b
         }
0a122b
 #endif
0a122b
     }
0a122b
-- 
0a122b
1.7.11.7
0a122b