diff mbox

[11/12] ram: iterate phase

Message ID cd73a246dbbb7a688e0000204f5af2040afe6578.1340910651.git.quintela@redhat.com
State New
Headers show

Commit Message

Juan Quintela June 28, 2012, 7:22 p.m. UTC
We only need to synchronize the bitmap when the number of dirty pages is low.
Not every time that we call the function.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 arch_init.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Igor Mitsyanko July 1, 2012, 12:17 p.m. UTC | #1
On 6/28/2012 11:22 PM, Juan Quintela wrote:
> We only need to synchronize the bitmap when the number of dirty pages is low.
> Not every time that we call the function.
>
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>   arch_init.c |    9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/arch_init.c b/arch_init.c
> index fe843a7..8299c15 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -348,8 +348,6 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
>       int i;
>       uint64_t expected_time;
>
> -    memory_global_sync_dirty_bitmap(get_system_memory());
> -
>       bytes_transferred_last = bytes_transferred;
>       bwidth = qemu_get_clock_ns(rt_clock);
>
> @@ -397,7 +395,12 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
>       DPRINTF("ram_save_live: expected(%ld) <= max(%ld)?\n", expected_time,
>               migrate_max_downtime());
>
> -    return expected_time <= migrate_max_downtime();
> +    if (expected_time <= migrate_max_downtime()) {
> +        memory_global_sync_dirty_bitmap(get_system_memory());
> +
> +        return expected_time <= migrate_max_downtime();

Shouldn't expected_time be recalculated after 
memory_global_sync_dirty_bitmap()?

> +    }
> +    return 0;
>   }
>
>   static int ram_save_complete(QEMUFile *f, void *opaque)
>
Juan Quintela July 3, 2012, 10:48 a.m. UTC | #2
Igor Mitsyanko <i.mitsyanko@gmail.com> wrote:
> On 6/28/2012 11:22 PM, Juan Quintela wrote:
>> We only need to synchronize the bitmap when the number of dirty pages is low.
>> Not every time that we call the function.
>>
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>   arch_init.c |    9 ++++++---
>>   1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch_init.c b/arch_init.c
>> index fe843a7..8299c15 100644
>> --- a/arch_init.c
>> +++ b/arch_init.c
>> @@ -348,8 +348,6 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
>>       int i;
>>       uint64_t expected_time;
>>
>> -    memory_global_sync_dirty_bitmap(get_system_memory());
>> -
>>       bytes_transferred_last = bytes_transferred;
>>       bwidth = qemu_get_clock_ns(rt_clock);
>>
>> @@ -397,7 +395,12 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
>>       DPRINTF("ram_save_live: expected(%ld) <= max(%ld)?\n", expected_time,
>>               migrate_max_downtime());
>>
>> -    return expected_time <= migrate_max_downtime();
>> +    if (expected_time <= migrate_max_downtime()) {
>> +        memory_global_sync_dirty_bitmap(get_system_memory());
>> +
>> +        return expected_time <= migrate_max_downtime();
>
> Shouldn't expected_time be recalculated after
> memory_global_sync_dirty_bitmap()?

It "depends" only of the network speed,
memory_global_sync_dirty_bitmap() should be really fast (notice that
with lots of memory this couldn't be true).

Later, Juan.
diff mbox

Patch

diff --git a/arch_init.c b/arch_init.c
index fe843a7..8299c15 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -348,8 +348,6 @@  static int ram_save_iterate(QEMUFile *f, void *opaque)
     int i;
     uint64_t expected_time;

-    memory_global_sync_dirty_bitmap(get_system_memory());
-
     bytes_transferred_last = bytes_transferred;
     bwidth = qemu_get_clock_ns(rt_clock);

@@ -397,7 +395,12 @@  static int ram_save_iterate(QEMUFile *f, void *opaque)
     DPRINTF("ram_save_live: expected(%ld) <= max(%ld)?\n", expected_time,
             migrate_max_downtime());

-    return expected_time <= migrate_max_downtime();
+    if (expected_time <= migrate_max_downtime()) {
+        memory_global_sync_dirty_bitmap(get_system_memory());
+
+        return expected_time <= migrate_max_downtime();
+    }
+    return 0;
 }

 static int ram_save_complete(QEMUFile *f, void *opaque)