All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: qemu-devel@nongnu.org, Ryan Harper <ryanh@us.ibm.com>,
	kvm <kvm@vger.kernel.org>
Subject: Re: [PATCH] Implement an fd pool to get real AIO with posix-aio
Date: Wed, 24 Sep 2008 12:02:23 +0300	[thread overview]
Message-ID: <48DA021F.2050504@redhat.com> (raw)
In-Reply-To: <1222202051-26701-1-git-send-email-aliguori@us.ibm.com>

Anthony Liguori wrote:
> This patch implements a simple fd pool to allow many AIO requests with
> posix-aio.  The result is significantly improved performance (identical to that
> reported for linux-aio) for both cache=on and cache=off.
>
> The fundamental problem with posix-aio is that it limits itself to one thread
> per-file descriptor.  I don't know why this is, but this patch provides a simple
> mechanism to work around this (duplicating the file descriptor).
>
> This isn't a great solution, but it seems like a reasonable intermediate step
> between posix-aio and a custom thread-pool to replace it.
>
>  
> +static int raw_fd_pool_get(BDRVRawState *s)
> +{
> +    int i;
> +
> +    for (i = 0; i < RAW_FD_POOL_SIZE; i++) {
> +        /* already in use */
> +        if (s->fd_pool[i] != -1)
> +            continue;
> +
> +        /* try to dup file descriptor */
> +        s->fd_pool[i] = dup(s->fd);
> +        if (s->fd_pool[i] != -1)
> +            return s->fd_pool[i];
> +    }
> +
> +    /* we couldn't dup the file descriptor so just use the main one */
> +    return s->fd;
> +}
> +
>   

dup()ing the fd on each request is unnecessary work; would be better to 
cache the duped fd.

Of course, if this is just a stepping stone, it doesn't matter very much.

-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2008-09-24  9:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-23 20:34 [PATCH] Implement an fd pool to get real AIO with posix-aio Anthony Liguori
2008-09-24  9:02 ` Avi Kivity [this message]
2008-09-24 14:17   ` Anthony Liguori

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=48DA021F.2050504@redhat.com \
    --to=avi@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    --cc=ryanh@us.ibm.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 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.