All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-2.5] block-migration: limit the memory usage
@ 2015-11-20  9:37 Wen Congyang
  2015-11-23 16:31 ` Juan Quintela
  0 siblings, 1 reply; 3+ messages in thread
From: Wen Congyang @ 2015-11-20  9:37 UTC (permalink / raw)
  To: qemu-devl, qemu block, Stefan Hajnoczi; +Cc: Amit Shah, Juan Quintela

If we set migration speed in a very large value, block-migration will try to read
all data to the memory. Because
    (block_mig_state.submitted + block_mig_state.read_done) * BLOCK_SIZE
will be overflow, and it will be always less than rate limit.

There is no need to read too many data into memory when the rate limit is very large.
So limit the memory usage can fix the overflow problem.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
---
 migration/block.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/migration/block.c b/migration/block.c
index 310e2b3..656f38f 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -36,6 +36,8 @@
 
 #define MAX_IS_ALLOCATED_SEARCH 65536
 
+#define MAX_INFLIGHT_IO 512
+
 //#define DEBUG_BLK_MIGRATION
 
 #ifdef DEBUG_BLK_MIGRATION
@@ -665,7 +667,10 @@ static int block_save_iterate(QEMUFile *f, void *opaque)
     blk_mig_lock();
     while ((block_mig_state.submitted +
             block_mig_state.read_done) * BLOCK_SIZE <
-           qemu_file_get_rate_limit(f)) {
+           qemu_file_get_rate_limit(f) &&
+           (block_mig_state.submitted +
+            block_mig_state.read_done) <
+           MAX_INFLIGHT_IO) {
         blk_mig_unlock();
         if (block_mig_state.bulk_completed == 0) {
             /* first finish the bulk phase */
-- 
2.5.0

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

* Re: [Qemu-devel] [PATCH for-2.5] block-migration: limit the memory usage
  2015-11-20  9:37 [Qemu-devel] [PATCH for-2.5] block-migration: limit the memory usage Wen Congyang
@ 2015-11-23 16:31 ` Juan Quintela
  2015-11-24  4:47   ` Stefan Hajnoczi
  0 siblings, 1 reply; 3+ messages in thread
From: Juan Quintela @ 2015-11-23 16:31 UTC (permalink / raw)
  To: Wen Congyang; +Cc: Amit Shah, Stefan Hajnoczi, qemu-devl, qemu block

Wen Congyang <wency@cn.fujitsu.com> wrote:
> If we set migration speed in a very large value, block-migration will try to read
> all data to the memory. Because
>     (block_mig_state.submitted + block_mig_state.read_done) * BLOCK_SIZE
> will be overflow, and it will be always less than rate limit.
>
> There is no need to read too many data into memory when the rate limit is very large.
> So limit the memory usage can fix the overflow problem.
>
> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>

Reviewed-by: Juan Quintela <quintela@redhat.com>

If no block layer maintainer objects, I will apply this to my tree.

Later, Juan.

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

* Re: [Qemu-devel] [PATCH for-2.5] block-migration: limit the memory usage
  2015-11-23 16:31 ` Juan Quintela
@ 2015-11-24  4:47   ` Stefan Hajnoczi
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2015-11-24  4:47 UTC (permalink / raw)
  To: Juan Quintela; +Cc: Amit Shah, qemu block, qemu-devl

[-- Attachment #1: Type: text/plain, Size: 802 bytes --]

On Mon, Nov 23, 2015 at 05:31:33PM +0100, Juan Quintela wrote:
> Wen Congyang <wency@cn.fujitsu.com> wrote:
> > If we set migration speed in a very large value, block-migration will try to read
> > all data to the memory. Because
> >     (block_mig_state.submitted + block_mig_state.read_done) * BLOCK_SIZE
> > will be overflow, and it will be always less than rate limit.
> >
> > There is no need to read too many data into memory when the rate limit is very large.
> > So limit the memory usage can fix the overflow problem.
> >
> > Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
> 
> Reviewed-by: Juan Quintela <quintela@redhat.com>
> 
> If no block layer maintainer objects, I will apply this to my tree.
> 
> Later, Juan.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

end of thread, other threads:[~2015-11-24  4:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-20  9:37 [Qemu-devel] [PATCH for-2.5] block-migration: limit the memory usage Wen Congyang
2015-11-23 16:31 ` Juan Quintela
2015-11-24  4:47   ` Stefan Hajnoczi

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.