qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] posix-aio-compat: Fix idle_threads counter
Date: Wed, 4 May 2011 08:41:14 +0100	[thread overview]
Message-ID: <BANLkTimSFioFYmgW4m8RDu6Kg4pA41w8Bg@mail.gmail.com> (raw)
In-Reply-To: <4DC03319.8030807@redhat.com>

On Tue, May 3, 2011 at 5:53 PM, Kevin Wolf <kwolf@redhat.com> wrote:
> Am 03.05.2011 17:56, schrieb Stefan Hajnoczi:
>> On Tue, May 3, 2011 at 2:26 PM, Kevin Wolf <kwolf@redhat.com> wrote:
>>> A thread should only be counted as idle when it really is waiting for new
>>> requests. Without this patch, sometimes too few threads are started as busy
>>> threads are counted as idle.
>>>
>>> Not sure if it makes a difference in practice outside some artificial
>>> qemu-io/qemu-img tests, but I think the change makes sense in any case.
>>>
>>> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
>>> ---
>>>  posix-aio-compat.c |    6 ++----
>>>  1 files changed, 2 insertions(+), 4 deletions(-)
>>
>> I think the critical change here is that idle_threads is not being
>> incremented by spawn_thread().  This means that we will keep spawning
>> threads as new requests come in and until the first thread goes idle.
>>
>> Previously you could imagine a scenario where we spawn a thread but
>> don't schedule it yet.  Then we immediately submit more I/O and since
>> idle_threads was incremented we don't spawn additional threads to
>> handle the requests.
>>
>> Are these the cases you were thinking about?
>
> Yes, this is the case that I noticed.
>
> However, I'm not sure if this is really the critical change. In this
> case, it would take a bit longer until you get your full 64 threads, but
> you should get there eventually and then it shouldn't impact performance
> any more.
>
> However, what I saw in my test case (qemu-img always running 16
> sequential read requests in parallel) was that I only got 16 threads.
> This sounds logical, but in fact you seem to need always one thread more
> for good performance (I don't fully understand this yet). And with this
> patch, you actually get 17 threads. The difference was like 8s vs. 22s
> for the same requests, and using more than 17 threads doesn't further
> improve it.

Wow, 8s vs 22s is a big difference.  Did you run any guest benchmarks?

Stefan

      reply	other threads:[~2011-05-04  7:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-03 13:26 [Qemu-devel] [PATCH] posix-aio-compat: Fix idle_threads counter Kevin Wolf
2011-05-03 15:56 ` Stefan Hajnoczi
2011-05-03 16:53   ` Kevin Wolf
2011-05-04  7:41     ` Stefan Hajnoczi [this message]

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=BANLkTimSFioFYmgW4m8RDu6Kg4pA41w8Bg@mail.gmail.com \
    --to=stefanha@gmail.com \
    --cc=kwolf@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;
as well as URLs for NNTP newsgroup(s).