public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jamie Lokier <jamie@shareable.org>
To: qemu-devel@nongnu.org
Cc: kvm-devel@lists.sourceforge.net, Marcelo Tosatti <mtosatti@redhat.com>
Subject: Re: [kvm-devel] Re: [PATCH 1/3] Refactor AIO interface to allow other AIO implementations
Date: Tue, 22 Apr 2008 16:23:22 +0100	[thread overview]
Message-ID: <20080422152321.GB10229@shareable.org> (raw)
In-Reply-To: <480DFEBC.1020504@qumranet.com>

Avi Kivity wrote:
> Anthony Liguori wrote:
> >>If I submit sequential O_DIRECT reads with aio_read(), will they enter
> >>the device read queue in the same order, and reach the disk in that
> >>order (allowing for reordering when worthwhile by the elevator)?
> >>  
> >There's no guarantee that any sort of order will be preserved by AIO 
> >requests.  The same is true with writes.  This is what fdsync is for, 
> >to guarantee ordering.
> 
> I believe he'd like a hint to get good scheduling, not a guarantee.  
> With a thread pool if the threads are scheduled out of order, so are 
> your requests.

> If the elevator doesn't plug the queue, the first few requests may
> not be optimally sorted.

That's right.  Then they tend to settle to a good order.  But any
delay in scheduling one of the threads, or a signal received by one of
them, can make it lose order briefly, making the streaming stutter as
the disk performes a few local seeks until it settles to good order
again.

You can mitigate the disruption in various ways.

  1. If all threads share an "offset" variable, and reads and
     increments that atomically just prior to calling pread(), that helps
     especially at the start.  (If threaded I/O is used for QEMU disk
     emulation, I would suggest doing that, in the more general form
     of popping a request from QEMU's internal shared queue at the last
     moment.)

  2. Using more threads helps keep it sustained, at the cost of more
     wasted I/O when there's a cancellation (changed mind), and more
     memory.

However, AIO, in principle (if not implementations...) could be better
at keeping the suggested I/O order than thread, without special tricks.

-- Jamie

  reply	other threads:[~2008-04-22 15:23 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-17 19:26 [PATCH 1/3] Refactor AIO interface to allow other AIO implementations Anthony Liguori
2008-04-17 19:26 ` [PATCH 2/3] Split out posix-aio code Anthony Liguori
2008-04-17 19:26 ` [PATCH 3/3] Implement linux-aio backend Anthony Liguori
2008-04-18 15:09   ` Marcelo Tosatti
2008-04-18 15:18     ` Anthony Liguori
2008-04-18 17:46       ` Marcelo Tosatti
2008-04-17 19:38 ` [PATCH 1/3] Refactor AIO interface to allow other AIO implementations Daniel P. Berrange
2008-04-17 19:41   ` [kvm-devel] " Anthony Liguori
2008-04-17 20:00     ` Daniel P. Berrange
2008-04-17 20:05       ` Anthony Liguori
2008-04-18 12:43       ` Re: [kvm-devel] " Jamie Lokier
2008-04-18 15:23         ` Anthony Liguori
2008-04-18 16:22           ` [Qemu-devel] " Jamie Lokier
2008-04-18 16:32           ` Avi Kivity
2008-04-20 15:49             ` Jamie Lokier
2008-04-20 18:43               ` Avi Kivity
2008-04-20 23:39                 ` Jamie Lokier
2008-04-21  6:39                   ` Avi Kivity
2008-04-21 12:10                     ` Jamie Lokier
2008-04-22  8:10                       ` Avi Kivity
2008-04-22 14:28                         ` [kvm-devel] " Jamie Lokier
2008-04-22 14:53                           ` [Qemu-devel] " Anthony Liguori
2008-04-22 15:05                             ` [kvm-devel] " Avi Kivity
2008-04-22 15:23                               ` Jamie Lokier [this message]
2008-04-22 15:12                             ` Jamie Lokier
2008-04-22 15:03                           ` [Qemu-devel] " Avi Kivity
2008-04-22 15:36                             ` [kvm-devel] " Jamie Lokier
2008-04-22 15:47                         ` [Qemu-devel] " Javier Guerra
2008-04-21  0:31                 ` Javier Guerra Giraldez
2008-04-21  6:41                   ` Avi Kivity

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=20080422152321.GB10229@shareable.org \
    --to=jamie@shareable.org \
    --cc=kvm-devel@lists.sourceforge.net \
    --cc=mtosatti@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox