All of lore.kernel.org
 help / color / mirror / Atom feed
From: Uri Lublin <uril@redhat.com>
To: qemu-devel@nongnu.org
Cc: Uri Lublin <uril@redhat.com>
Subject: [Qemu-devel] [RESEND] [PATCH 1/2] migrate.c: migrate_fd_put_buffer(): Do not	busyloop: stop writing if EWOULDBLOCK
Date: Tue, 10 Feb 2009 05:04:25 +0200	[thread overview]
Message-ID: <4990EEB9.8080208@redhat.com> (raw)

Theoretically the migration code is non-blocking, designed for live migration.

Practically migrate_fd_put_buffer busy-loops trying to write. That's since
on many machines EWOULDBLOCK==EAGAIN (e.g. look in
<linux>/include/asm-generic/errno.h).
Busy looping is much worse then blocking (in case a write actually blocks).

Fixed by removing "(s->get_error(s)) == EWOULDBLOCK)" from the while condition.

Signed-off-by: Uri Lublin <uril@redhat.com>
---
  migration.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/migration.c b/migration.c
index 0ef777a..e8bafa6 100644
--- a/migration.c
+++ b/migration.c
@@ -168,7 +168,7 @@ ssize_t migrate_fd_put_buffer(void *opaque, const void 
*data, size_t size)

      do {
          ret = s->write(s, data, size);
-    } while (ret == -1 && ((s->get_error(s)) == EINTR || (s->get_error(s)) == 
EWOULDBLOCK));
+    } while (ret == -1 && s->get_error(s) == EINTR);

      if (ret == -1)
          ret = -(s->get_error(s));
-- 
1.6.0.6

                 reply	other threads:[~2009-02-10  3:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4990EEB9.8080208@redhat.com \
    --to=uril@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 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.