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

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