All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 5/7] migration: Fix the migrate auto converge process
@ 2014-02-28  4:11 Gonglei (Arei)
  2014-02-28 10:16 ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 3+ messages in thread
From: Gonglei (Arei) @ 2014-02-28  4:11 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Juan Quintela, pl, owasserm, aliguori,
	chenliang (T),
	pbonzini

It is inaccuracy and complex that using the transfer speed of
migration thread to determine whether the convergence migration.
The dirty page may be compressed by XBZRLE or ZERO_PAGE.The counter
of updating dirty bitmap will be increasing continuously if the
migration can't convergence.

Signed-off-by: ChenLiang <chenliang88@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
 arch_init.c | 26 +++-----------------------
 1 file changed, 3 insertions(+), 23 deletions(-)

diff --git a/arch_init.c b/arch_init.c
index fc71331..2211e0b 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -107,7 +107,6 @@ int graphic_depth = 32;
 
 const uint32_t arch_type = QEMU_ARCH;
 static bool mig_throttle_on;
-static int dirty_rate_high_cnt;
 static void check_guest_throttling(void);
 
 static uint64_t bitmap_sync_cnt;
@@ -464,17 +463,11 @@ static void migration_bitmap_sync(void)
     uint64_t num_dirty_pages_init = migration_dirty_pages;
     MigrationState *s = migrate_get_current();
     static int64_t start_time;
-    static int64_t bytes_xfer_prev;
     static int64_t num_dirty_pages_period;
     int64_t end_time;
-    int64_t bytes_xfer_now;
 
     increase_bitmap_sync_cnt();
 
-    if (!bytes_xfer_prev) {
-        bytes_xfer_prev = ram_bytes_transferred();
-    }
-
     if (!start_time) {
         start_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
     }
@@ -493,21 +486,9 @@ static void migration_bitmap_sync(void)
     /* more than 1 second = 1000 millisecons */
     if (end_time > start_time + 1000) {
         if (migrate_auto_converge()) {
-            /* The following detection logic can be refined later. For now:
-               Check to see if the dirtied bytes is 50% more than the approx.
-               amount of bytes that just got transferred since the last time we
-               were in this routine. If that happens >N times (for now N==4)
-               we turn on the throttle down logic */
-            bytes_xfer_now = ram_bytes_transferred();
-            if (s->dirty_pages_rate &&
-               (num_dirty_pages_period * TARGET_PAGE_SIZE >
-                   (bytes_xfer_now - bytes_xfer_prev)/2) &&
-               (dirty_rate_high_cnt++ > 4)) {
-                    trace_migration_throttle();
-                    mig_throttle_on = true;
-                    dirty_rate_high_cnt = 0;
-             }
-             bytes_xfer_prev = bytes_xfer_now;
+            if (get_bitmap_sync_cnt() > 15) {
+                mig_throttle_on = true;
+            }
         } else {
              mig_throttle_on = false;
         }
@@ -712,7 +693,6 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
     bitmap_set(migration_bitmap, 0, ram_pages);
     migration_dirty_pages = ram_pages;
     mig_throttle_on = false;
-    dirty_rate_high_cnt = 0;
     reset_bitmap_sync_cnt();
 
     if (migrate_use_xbzrle()) {
-- 
1.7.12.4

Best regards,
-Gonglei

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH 5/7] migration: Fix the migrate auto converge process
  2014-02-28  4:11 [Qemu-devel] [PATCH 5/7] migration: Fix the migrate auto converge process Gonglei (Arei)
@ 2014-02-28 10:16 ` Dr. David Alan Gilbert
  2014-02-28 11:03   ` Gonglei
  0 siblings, 1 reply; 3+ messages in thread
From: Dr. David Alan Gilbert @ 2014-02-28 10:16 UTC (permalink / raw)
  To: Gonglei (Arei)
  Cc: chenliang (T),
	Peter Maydell, Juan Quintela, pl, qemu-devel, aliguori, pbonzini

* Gonglei (Arei) (arei.gonglei@huawei.com) wrote:
> It is inaccuracy and complex that using the transfer speed of
> migration thread to determine whether the convergence migration.
> The dirty page may be compressed by XBZRLE or ZERO_PAGE.The counter
> of updating dirty bitmap will be increasing continuously if the
> migration can't convergence.
> 
> Signed-off-by: ChenLiang <chenliang88@huawei.com>
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
>  arch_init.c | 26 +++-----------------------
>  1 file changed, 3 insertions(+), 23 deletions(-)
> 
> diff --git a/arch_init.c b/arch_init.c
> index fc71331..2211e0b 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -107,7 +107,6 @@ int graphic_depth = 32;
>  
>  const uint32_t arch_type = QEMU_ARCH;
>  static bool mig_throttle_on;
> -static int dirty_rate_high_cnt;
>  static void check_guest_throttling(void);
>  
>  static uint64_t bitmap_sync_cnt;
> @@ -464,17 +463,11 @@ static void migration_bitmap_sync(void)
>      uint64_t num_dirty_pages_init = migration_dirty_pages;
>      MigrationState *s = migrate_get_current();
>      static int64_t start_time;
> -    static int64_t bytes_xfer_prev;
>      static int64_t num_dirty_pages_period;
>      int64_t end_time;
> -    int64_t bytes_xfer_now;
>  
>      increase_bitmap_sync_cnt();
>  
> -    if (!bytes_xfer_prev) {
> -        bytes_xfer_prev = ram_bytes_transferred();
> -    }
> -
>      if (!start_time) {
>          start_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
>      }
> @@ -493,21 +486,9 @@ static void migration_bitmap_sync(void)
>      /* more than 1 second = 1000 millisecons */
>      if (end_time > start_time + 1000) {
>          if (migrate_auto_converge()) {
> -            /* The following detection logic can be refined later. For now:
> -               Check to see if the dirtied bytes is 50% more than the approx.
> -               amount of bytes that just got transferred since the last time we
> -               were in this routine. If that happens >N times (for now N==4)
> -               we turn on the throttle down logic */
> -            bytes_xfer_now = ram_bytes_transferred();
> -            if (s->dirty_pages_rate &&
> -               (num_dirty_pages_period * TARGET_PAGE_SIZE >
> -                   (bytes_xfer_now - bytes_xfer_prev)/2) &&
> -               (dirty_rate_high_cnt++ > 4)) {
> -                    trace_migration_throttle();
> -                    mig_throttle_on = true;
> -                    dirty_rate_high_cnt = 0;
> -             }
> -             bytes_xfer_prev = bytes_xfer_now;
> +            if (get_bitmap_sync_cnt() > 15) {
> +                mig_throttle_on = true;
> +            }

That is a lot simpler, and I suspect as good - again I'd
move that magic '15' to a constant somewhere.

What have you tested this on - have you tested with really big RAM VMs?
What's it's behaviour like with rate-limiting?

Dave
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH 5/7] migration: Fix the migrate auto converge process
  2014-02-28 10:16 ` Dr. David Alan Gilbert
@ 2014-02-28 11:03   ` Gonglei
  0 siblings, 0 replies; 3+ messages in thread
From: Gonglei @ 2014-02-28 11:03 UTC (permalink / raw)
  To: Dr. David Alan Gilbert
  Cc: chenliang (T),
	Peter Maydell, Juan Quintela, pl, qemu-devel, aliguori, pbonzini

On 2014/2/28 18:16, Dr. David Alan Gilbert wrote:

> * Gonglei (Arei) (arei.gonglei@huawei.com) wrote:
>> It is inaccuracy and complex that using the transfer speed of
>> migration thread to determine whether the convergence migration.
>> The dirty page may be compressed by XBZRLE or ZERO_PAGE.The counter
>> of updating dirty bitmap will be increasing continuously if the
>> migration can't convergence.
>>
>> Signed-off-by: ChenLiang <chenliang88@huawei.com>
>> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
>> ---
>>  arch_init.c | 26 +++-----------------------
>>  1 file changed, 3 insertions(+), 23 deletions(-)
>>
>> diff --git a/arch_init.c b/arch_init.c
>> index fc71331..2211e0b 100644
>> --- a/arch_init.c
>> +++ b/arch_init.c
>> @@ -107,7 +107,6 @@ int graphic_depth = 32;
>>  
>>  const uint32_t arch_type = QEMU_ARCH;
>>  static bool mig_throttle_on;
>> -static int dirty_rate_high_cnt;
>>  static void check_guest_throttling(void);
>>  
>>  static uint64_t bitmap_sync_cnt;
>> @@ -464,17 +463,11 @@ static void migration_bitmap_sync(void)
>>      uint64_t num_dirty_pages_init = migration_dirty_pages;
>>      MigrationState *s = migrate_get_current();
>>      static int64_t start_time;
>> -    static int64_t bytes_xfer_prev;
>>      static int64_t num_dirty_pages_period;
>>      int64_t end_time;
>> -    int64_t bytes_xfer_now;
>>  
>>      increase_bitmap_sync_cnt();
>>  
>> -    if (!bytes_xfer_prev) {
>> -        bytes_xfer_prev = ram_bytes_transferred();
>> -    }
>> -
>>      if (!start_time) {
>>          start_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
>>      }
>> @@ -493,21 +486,9 @@ static void migration_bitmap_sync(void)
>>      /* more than 1 second = 1000 millisecons */
>>      if (end_time > start_time + 1000) {
>>          if (migrate_auto_converge()) {
>> -            /* The following detection logic can be refined later. For now:
>> -               Check to see if the dirtied bytes is 50% more than the approx.
>> -               amount of bytes that just got transferred since the last time we
>> -               were in this routine. If that happens >N times (for now N==4)
>> -               we turn on the throttle down logic */
>> -            bytes_xfer_now = ram_bytes_transferred();
>> -            if (s->dirty_pages_rate &&
>> -               (num_dirty_pages_period * TARGET_PAGE_SIZE >
>> -                   (bytes_xfer_now - bytes_xfer_prev)/2) &&
>> -               (dirty_rate_high_cnt++ > 4)) {
>> -                    trace_migration_throttle();
>> -                    mig_throttle_on = true;
>> -                    dirty_rate_high_cnt = 0;
>> -             }
>> -             bytes_xfer_prev = bytes_xfer_now;
>> +            if (get_bitmap_sync_cnt() > 15) {
>> +                mig_throttle_on = true;
>> +            }
> 
> That is a lot simpler, and I suspect as good - again I'd
> move that magic '15' to a constant somewhere.
> 

Thanks, Check it.

> What have you tested this on - have you tested with really big RAM VMs?
> What's it's behaviour like with rate-limiting?
> 
> Dave

Yeah, We have tested it using 25G memory VM as the first mail said.

>>
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK


Best regards,
-Gonglei

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-28 11:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-28  4:11 [Qemu-devel] [PATCH 5/7] migration: Fix the migrate auto converge process Gonglei (Arei)
2014-02-28 10:16 ` Dr. David Alan Gilbert
2014-02-28 11:03   ` Gonglei

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.