qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: owasserm@redhat.com, quintela@redhat.com
Subject: [Qemu-devel] [PATCH] migration: fix rate limiting
Date: Mon, 19 Nov 2012 17:23:00 +0100	[thread overview]
Message-ID: <1353342180-20392-1-git-send-email-pbonzini@redhat.com> (raw)

buffered_rate_limit is called to prevent the RAM migration callback
from putting too much data in the buffer.  So it has to check against
the amount of data currently in the buffer, not against the amount
of data that has been transferred so far.

s->bytes_xfer is used to communicate between successive calls of
buffered_put_buffer.  Buffered_rate_tick resets it every now and
then to prevent moving too much buffered data to the socket at
once.  However, its value does not matter for the producer of the
data.

Here is the result for migrating an idle guest with 3GB of memory
and ~360MB of non-zero memory:

  migrate_set_speed       Before                After
  ------------------------------------------------------------
  default (32MB/sec)      ~3 sec                ~13 sec
  infinite (10GB/sec)     ~3 sec                ~3 sec

Note that before this patch, QEMU is transferring of 100 MB/sec
despite the rate limiting.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 buffered_file.c | 2 +-
 1 file modificato, 1 inserzione(+). 1 rimozione(-)

diff --git a/buffered_file.c b/buffered_file.c
index bd0f61d..46cd591 100644
--- a/buffered_file.c
+++ b/buffered_file.c
@@ -193,7 +193,7 @@ static int buffered_rate_limit(void *opaque)
     if (s->freeze_output)
         return 1;
 
-    if (s->bytes_xfer > s->xfer_limit)
+    if (s->buffer_size > s->xfer_limit)
         return 1;
 
     return 0;
-- 
1.7.12.1

             reply	other threads:[~2012-11-19 16:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-19 16:23 Paolo Bonzini [this message]
2012-11-20 11:03 ` [Qemu-devel] [PATCH] migration: fix rate limiting Juan Quintela
2012-11-20 14:44   ` Paolo Bonzini
2012-11-20 14:59     ` Juan Quintela

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1353342180-20392-1-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=owasserm@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).