migration: calculate expected_downtime considering redirtied ram
cover migration: calculate expected_downtime considering redirtied ram
From: Balamuruhan S <[email protected]>
Based on the discussion with Dave and David Gibson earlier with respect to expected_downtime calculation,
https://lists.gnu.org/archive/html/qemu-devel/2018-04/msg02418.html
got suggestions that the calculation is of not accurate and we need to consider the ram that gets redirtied during the time when we would have actually transferred ram in the current iteration.
so I have came up with a calculation by considering the ram that could get redirtied during the current iteration at the time we would have transferred the remaining ram in current iteration. By this way, the total ram to be transferred will be remaining ram + redirtied ram and dividing with bandwidth would yield us better expected_downtime value.
Please help to review and suggest about this approach.
Balamuruhan S (1):
migration: calculate expected_downtime considering redirtied ram
migration/migration.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
Signature · 1 line
2.14.5
PATCH 1/1 migration: calculate expected_downtime considering redirtied ram
From: Balamuruhan S <[email protected]>
currently we calculate expected_downtime by time taken to transfer remaining ram, but during the time we had transferred remaining ram few pages of ram might be redirtied and we need to retransfer it, so it is better to consider them for calculating expected_downtime for getting more accurate values.
Total ram to be transferred = remaining ram + (redirtied ram at the
time when the remaining ram gets transferred)
redirtied ram = dirty_pages_rate * time taken to transfer remaining ram
redirtied ram = dirty_pages_rate * (remaining ram / bandwidth)
expected_downtime = (remaining ram + redirtied ram) / bandwidth
--- migration/migration.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
migration/migration.c +7 -1
@@ -2903,7 +2903,13 @@ static void migration_update_counters(MigrationState *s,* recalculate. 10000 is a small enough number for our purposes */ if (ram_counters.dirty_pages_rate && transferred >10000 ) { - s->expected_downtime = ram_counters.remaining / bandwidth; +/* Time required to transfer remaining ram */ + remaining_ram_transfer_time = ram_counters.remaining / bandwidth + +/* redirty of ram at the time remaining ram gets transferred*/ + newly_dirtied_ram = ram_counters.dirty_pages_rate * remaining_ram_transfer_time + + s->expected_downtime = (ram_counters.remaining + newly_dirtied_ram) / bandwidth; }qemu_file_reset_rate_limit (s->to_dst_file);
Signature · 1 line
2.14.5
Quoted 30 lines · [email protected] wrote:
From: Balamuruhan S <[email protected]>
currently we calculate
expected_downtimeby time taken to transfer remaining ram, but during the time we had transferred remaining ram few pages of ram might be redirtied and we need to retransfer it, so it is better to consider them for calculatingexpected_downtimefor getting more accurate values.Total ram to be transferred = remaining ram + (redirtied ram at the
time when the remaining ram gets transferred)redirtied ram =
dirty_pages_rate* time taken to transfer remaining ramredirtied ram =
dirty_pages_rate* (remaining ram / bandwidth)
expected_downtime= (remaining ram + redirtied ram) / bandwidthSuggested-by David Gibson <[email protected]>Suggested-by Dr. David Alan Gilbert <[email protected]>Signed-off-by Balamuruhan S <[email protected]>--- migration/migration.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)migration/migration.c +0
-0
migration/migration.c static void migration_update_counters(MigrationState *s, · line 2907
Quoted 6 lines
migration/migration.c +2
-1@@ -2903,7 +2903,13 @@ static void migration_update_counters(MigrationState *s,* recalculate. 10000 is a small enough number for our purposes */ if (ram_counters.dirty_pages_rate && transferred >10000 ) { - s->expected_downtime = ram_counters.remaining / bandwidth; +/* Time required to transfer remaining ram */ + remaining_ram_transfer_time = ram_counters.remaining / bandwidth
missing semicolon
migration/migration.c static void migration_update_counters(MigrationState *s, · line 2910
Quoted 3 lines
migration/migration.c +3
-0+ +/* redirty of ram at the time remaining ram gets transferred*/ + newly_dirtied_ram = ram_counters.dirty_pages_rate * remaining_ram_transfer_time
the same.
Declaration of the new variables is also missing.
migration/migration.c static void migration_update_counters(MigrationState *s, · line 2915
Quoted 4 lines
migration/migration.c +1
-0+ s->expected_downtime = (ram_counters.remaining + newly_dirtied_ram) / bandwidth; }qemu_file_reset_rate_limit (s->to_dst_file);
About the numbers, I am not against it. It is an heuristic. Without numbers (and it is very load dependent) it is not clear that this one is going to be much worse/better than previous one (this should be a bit better, though).
Thanks, Juan.
Quoted 51 lines · Juan Quintela
Quoted 30 lines · [email protected] wrote:
From: Balamuruhan S <[email protected]>
currently we calculate
expected_downtimeby time taken to transfer remaining ram, but during the time we had transferred remaining ram few pages of ram might be redirtied and we need to retransfer it, so it is better to consider them for calculatingexpected_downtimefor getting more accurate values.Total ram to be transferred = remaining ram + (redirtied ram at the
time when the remaining ram gets transferred)redirtied ram =
dirty_pages_rate* time taken to transfer remaining ramredirtied ram =
dirty_pages_rate* (remaining ram / bandwidth)
expected_downtime= (remaining ram + redirtied ram) / bandwidthSuggested-by David Gibson <[email protected]>Suggested-by Dr. David Alan Gilbert <[email protected]>Signed-off-by Balamuruhan S <[email protected]>--- migration/migration.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)migration/migration.c +0
-0migration/migration.c static void migration_update_counters(MigrationState *s, · line 2907
Quoted 6 lines
migration/migration.c +2
-1@@ -2903,7 +2903,13 @@ static void migration_update_counters(MigrationState *s,* recalculate. 10000 is a small enough number for our purposes */ if (ram_counters.dirty_pages_rate && transferred >10000 ) { - s->expected_downtime = ram_counters.remaining / bandwidth; +/* Time required to transfer remaining ram */ + remaining_ram_transfer_time = ram_counters.remaining / bandwidthmissing semicolon
migration/migration.c static void migration_update_counters(MigrationState *s, · line 2910
Quoted 3 lines
migration/migration.c +3
-0+ +/* redirty of ram at the time remaining ram gets transferred*/ + newly_dirtied_ram = ram_counters.dirty_pages_rate * remaining_ram_transfer_timethe same.
Declaration of the new variables is also missing.
Quoted 3 lines
migration/migration.c +1
-0+ s->expected_downtime = (ram_counters.remaining + newly_dirtied_ram) / bandwidth; }
Quoted 6 lines
migration/migration.c static void migration_update_counters(MigrationState *s, · line 2915
Quoted 1 line
migration/migration.c +0
-0qemu_file_reset_rate_limit (s->to_dst_file);About the numbers, I am not against it. It is an heuristic. Without numbers (and it is very load dependent) it is not clear that this one is going to be much worse/better than previous one (this should be a bit better, though).
Actually I have had a question on how expected_downtime is defined and how it will be used by users.
My understanding is that the expected_downtime is defined as: how long time the guest will be down if we stop the VM right now and migrate all the rest of pages.
This definition makes sense in that it helps the customer to dynamically decide whether it's a good point to go into the last phase of migration. Currently we should be able to achieve that by setting a very high target downtime.
And if that definition is the thing we want, the current calculation seems exactly the number we want, since if we stop the VM right now then there won't be any more data to be dirtied as well.
Regards,
Signature · 1 line
Peter Xu
Quoted 66 lines · Peter Xu
Quoted 51 lines · Juan Quintela
Quoted 30 lines · [email protected] wrote:
From: Balamuruhan S <[email protected]>
currently we calculate
expected_downtimeby time taken to transfer remaining ram, but during the time we had transferred remaining ram few pages of ram might be redirtied and we need to retransfer it, so it is better to consider them for calculatingexpected_downtimefor getting more accurate values.Total ram to be transferred = remaining ram + (redirtied ram at the
time when the remaining ram gets transferred)redirtied ram =
dirty_pages_rate* time taken to transfer remaining ramredirtied ram =
dirty_pages_rate* (remaining ram / bandwidth)
expected_downtime= (remaining ram + redirtied ram) / bandwidthSuggested-by David Gibson <[email protected]>Suggested-by Dr. David Alan Gilbert <[email protected]>Signed-off-by Balamuruhan S <[email protected]>--- migration/migration.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)migration/migration.c +0
-0migration/migration.c static void migration_update_counters(MigrationState *s, · line 2907
Quoted 6 lines
migration/migration.c +2
-1@@ -2903,7 +2903,13 @@ static void migration_update_counters(MigrationState *s,* recalculate. 10000 is a small enough number for our purposes */ if (ram_counters.dirty_pages_rate && transferred >10000 ) { - s->expected_downtime = ram_counters.remaining / bandwidth; +/* Time required to transfer remaining ram */ + remaining_ram_transfer_time = ram_counters.remaining / bandwidthmissing semicolon
migration/migration.c static void migration_update_counters(MigrationState *s, · line 2910
Quoted 3 lines
migration/migration.c +3
-0+ +/* redirty of ram at the time remaining ram gets transferred*/ + newly_dirtied_ram = ram_counters.dirty_pages_rate * remaining_ram_transfer_timethe same.
Declaration of the new variables is also missing.
Quoted 3 lines
migration/migration.c +1
-0+ s->expected_downtime = (ram_counters.remaining + newly_dirtied_ram) / bandwidth; }Quoted 6 lines
migration/migration.c static void migration_update_counters(MigrationState *s, · line 2915
Quoted 1 line
migration/migration.c +0
-0qemu_file_reset_rate_limit (s->to_dst_file);About the numbers, I am not against it. It is an heuristic. Without numbers (and it is very load dependent) it is not clear that this one is going to be much worse/better than previous one (this should be a bit better, though).
Actually I have had a question on how
expected_downtimeis defined and how it will be used by users.My understanding is that the
expected_downtimeis defined as: how long time the guest will be down if we stop the VM right now and migrate all the rest of pages.
Quoted 8 lines
This definition makes sense in that it helps the customer to dynamically decide whether it's a good point to go into the last phase of migration. Currently we should be able to achieve that by setting a very high target downtime.
And if that definition is the thing we want, the current calculation seems exactly the number we want, since if we stop the VM right now then there won't be any more data to be dirtied as well.
Thank you Peter, I thought about your definition and it makes sense with your definition that existing calculation is appropriate and correct.
-- Bala
Quoted 6 lines
Regards,
Signature · 1 line
Peter Xu
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series failed the docker-mingw@fedora build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.
=== TEST SCRIPT BEGIN ===
#!/bin/bash
time make docker-test-mingw@fedora SHOW_ENV=1 J=14 === TEST SCRIPT END ===
CC net/util.o
CC net/hub.o/tmp/qemu-test/src/migration/migration.c: In function 'migration_update_counters':/tmp/qemu-test/src/migration/migration.c:2907:9: error: 'remaining_ram_transfer_time' undeclared (first use in this function)
remaining_ram_transfer_time = ram_counters.remaining / bandwidth
^~~~~~~~~~~~~~~~~~~~~~~~~~~/tmp/qemu-test/src/migration/migration.c:2907:9: note: each undeclared identifier is reported only once for each function it appears in /tmp/qemu-test/src/migration/migration.c:2907:73: error: expected ';' before 'newly_dirtied_ram'
remaining_ram_transfer_time = ram_counters.remaining / bandwidth
^
;The full log is available at
http://patchew.org/logs/[email protected]/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]