diff mbox

[09/12] ram: save_live_setup() don't need to sent pages

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

Commit Message

Juan Quintela June 28, 2012, 7:22 p.m. UTC
We should send pages on interate phase, not in setup one.  This was a
"bug".  Just removing the loop does what we want.  Tested that it
works with current ram_load().

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

Comments

Orit Wasserman July 2, 2012, noon UTC | #1
On 06/28/2012 10:22 PM, Juan Quintela wrote:
> We should send pages on interate phase, not in setup one.  This was a
> "bug".  Just removing the loop does what we want.  Tested that it
> works with current ram_load().
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  arch_init.c |   33 ---------------------------------
>  1 file changed, 33 deletions(-)
> 
> diff --git a/arch_init.c b/arch_init.c
> index d5d7a78..1eab331 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -307,9 +307,6 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
>  {
>      ram_addr_t addr;
>      RAMBlock *block;
> -    double bwidth = 0;
> -    int ret;
> -    int i;
> 
>      memory_global_sync_dirty_bitmap(get_system_memory());
> 
> @@ -338,36 +335,6 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
>          qemu_put_be64(f, block->length);
>      }
> 
> -    bwidth = qemu_get_clock_ns(rt_clock);
> -
> -    i = 0;
> -    while ((ret = qemu_file_rate_limit(f)) == 0) {
> -        int bytes_sent;
> -
> -        bytes_sent = ram_save_block(f);
> -        bytes_transferred += bytes_sent;
> -        if (bytes_sent == 0) { /* no more blocks */
> -            break;
> -        }
> -        /* we want to check in the 1st loop, just in case it was the 1st time
> -           and we had to sync the dirty bitmap.
> -           qemu_get_clock_ns() is a bit expensive, so we only check each some
> -           iterations
> -        */
> -        if ((i & 63) == 0) {
> -            uint64_t t1 = (qemu_get_clock_ns(rt_clock) - bwidth) / 1000000;
> -            if (t1 > MAX_WAIT) {
> -                DPRINTF("big wait: %ld milliseconds, %d iterations\n", t1, i);
> -                break;
> -            }
> -        }
> -        i++;
> -    }
> -
> -    if (ret < 0) {
> -        return ret;
> -    }
> -
>      qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
> 
>      return 0;
> 
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
diff mbox

Patch

diff --git a/arch_init.c b/arch_init.c
index d5d7a78..1eab331 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -307,9 +307,6 @@  static int ram_save_setup(QEMUFile *f, void *opaque)
 {
     ram_addr_t addr;
     RAMBlock *block;
-    double bwidth = 0;
-    int ret;
-    int i;

     memory_global_sync_dirty_bitmap(get_system_memory());

@@ -338,36 +335,6 @@  static int ram_save_setup(QEMUFile *f, void *opaque)
         qemu_put_be64(f, block->length);
     }

-    bwidth = qemu_get_clock_ns(rt_clock);
-
-    i = 0;
-    while ((ret = qemu_file_rate_limit(f)) == 0) {
-        int bytes_sent;
-
-        bytes_sent = ram_save_block(f);
-        bytes_transferred += bytes_sent;
-        if (bytes_sent == 0) { /* no more blocks */
-            break;
-        }
-        /* we want to check in the 1st loop, just in case it was the 1st time
-           and we had to sync the dirty bitmap.
-           qemu_get_clock_ns() is a bit expensive, so we only check each some
-           iterations
-        */
-        if ((i & 63) == 0) {
-            uint64_t t1 = (qemu_get_clock_ns(rt_clock) - bwidth) / 1000000;
-            if (t1 > MAX_WAIT) {
-                DPRINTF("big wait: %ld milliseconds, %d iterations\n", t1, i);
-                break;
-            }
-        }
-        i++;
-    }
-
-    if (ret < 0) {
-        return ret;
-    }
-
     qemu_put_be64(f, RAM_SAVE_FLAG_EOS);

     return 0;