Blame SOURCES/kvm-migration-calculate-expected_downtime-with-ram_bytes.patch

383d26
From 4d7902d7277992139d575552f09c2ff6827e9794 Mon Sep 17 00:00:00 2001
383d26
From: Laurent Vivier <lvivier@redhat.com>
383d26
Date: Thu, 21 Jun 2018 09:45:26 +0200
383d26
Subject: [PATCH 14/89] migration: calculate expected_downtime with
383d26
 ram_bytes_remaining()
383d26
383d26
RH-Author: Laurent Vivier <lvivier@redhat.com>
383d26
Message-id: <20180621094526.5714-1-lvivier@redhat.com>
383d26
Patchwork-id: 80931
383d26
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH] migration: calculate expected_downtime with ram_bytes_remaining()
383d26
Bugzilla: 1564576
383d26
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
383d26
RH-Acked-by: Thomas Huth <thuth@redhat.com>
383d26
RH-Acked-by: David Gibson <dgibson@redhat.com>
383d26
383d26
From: Balamuruhan S <bala24@linux.vnet.ibm.com>
383d26
383d26
expected_downtime value is not accurate with dirty_pages_rate * page_size,
383d26
using ram_bytes_remaining() would yeild it resonable.
383d26
383d26
consider to read the remaining ram just after having updated the dirty
383d26
pages count later migration_bitmap_sync_range() in migration_bitmap_sync()
383d26
and reuse the `remaining` field in ram_counters to hold ram_bytes_remaining()
383d26
for calculating expected_downtime.
383d26
383d26
Reported-by: Michael Roth <mdroth@linux.vnet.ibm.com>
383d26
Signed-off-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
383d26
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
383d26
Message-Id: <20180612085009.17594-2-bala24@linux.vnet.ibm.com>
383d26
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
383d26
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
383d26
(cherry picked from commit 650af8907bd567db914b7ce3a7e9df4c323f4619)
383d26
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
383d26
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
383d26
---
383d26
 migration/migration.c | 3 +--
383d26
 migration/ram.c       | 1 +
383d26
 2 files changed, 2 insertions(+), 2 deletions(-)
383d26
383d26
diff --git a/migration/migration.c b/migration/migration.c
383d26
index ef4bb42..43d8a64 100644
383d26
--- a/migration/migration.c
383d26
+++ b/migration/migration.c
383d26
@@ -2239,8 +2239,7 @@ static void migration_update_counters(MigrationState *s,
383d26
      * recalculate. 10000 is a small enough number for our purposes
383d26
      */
383d26
     if (ram_counters.dirty_pages_rate && transferred > 10000) {
383d26
-        s->expected_downtime = ram_counters.dirty_pages_rate *
383d26
-            qemu_target_page_size() / bandwidth;
383d26
+        s->expected_downtime = ram_counters.remaining / bandwidth;
383d26
     }
383d26
 
383d26
     qemu_file_reset_rate_limit(s->to_dst_file);
383d26
diff --git a/migration/ram.c b/migration/ram.c
383d26
index 0e90efa..00c06b5 100644
383d26
--- a/migration/ram.c
383d26
+++ b/migration/ram.c
383d26
@@ -852,6 +852,7 @@ static void migration_bitmap_sync(RAMState *rs)
383d26
     RAMBLOCK_FOREACH(block) {
383d26
         migration_bitmap_sync_range(rs, block, 0, block->used_length);
383d26
     }
383d26
+    ram_counters.remaining = ram_bytes_remaining();
383d26
     rcu_read_unlock();
383d26
     qemu_mutex_unlock(&rs->bitmap_mutex);
383d26
 
383d26
-- 
383d26
1.8.3.1
383d26