qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Stefano Garzarella <sgarzare@redhat.com>
Cc: "Kevin Wolf" <kwolf@redhat.com>, "Fam Zheng" <fam@euphon.net>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	qemu-block@nongnu.org, "Markus Armbruster" <armbru@redhat.com>,
	qemu-devel@nongnu.org, "Max Reitz" <mreitz@redhat.com>,
	"Stefan Weil" <sw@weilnetz.de>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Eric Blake" <eblake@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [PATCH 3/3] linux-aio: limit the batch size using `aio-max-batch` parameter
Date: Tue, 20 Jul 2021 11:41:34 +0100	[thread overview]
Message-ID: <YPaoXutDKwmekoew@stefanha-x1.localdomain> (raw)
In-Reply-To: <20210719103553.2732gqgnvc4nuzlh@steredhat>

[-- Attachment #1: Type: text/plain, Size: 1819 bytes --]

On Mon, Jul 19, 2021 at 12:35:53PM +0200, Stefano Garzarella wrote:
> On Tue, Jul 13, 2021 at 03:58:04PM +0100, Stefan Hajnoczi wrote:
> > On Wed, Jul 07, 2021 at 05:00:19PM +0200, Stefano Garzarella wrote:
> > > @@ -371,7 +375,7 @@ static int laio_do_submit(int fd, struct qemu_laiocb *laiocb, off_t offset,
> > >      s->io_q.in_queue++;
> > >      if (!s->io_q.blocked &&
> > >          (!s->io_q.plugged ||
> > > -         s->io_q.in_flight + s->io_q.in_queue >= MAX_EVENTS)) {
> > > +         s->io_q.in_queue >= max_batch)) {
> > 
> > Is it safe to drop the MAX_EVENTS case?
> 
> I think it is safe since in ioq_submit() we have this check while
> dequeueing:
> 
>         QSIMPLEQ_FOREACH(aiocb, &s->io_q.pending, next) {
>             iocbs[len++] = &aiocb->iocb;
>             if (s->io_q.in_flight + len >= MAX_EVENTS) {
>                 break;
>             }
>         }
> 
> But in term of performance, I think is better what you're suggesting,
> because if we have fewer slots available than `max_batch`, here we were
> delaying the call to io_submit().
> 
> > 
> > Perhaps the following can be used:
> > 
> >  int64_t max_batch = s->aio_context->aio_max_batch ?: DEFAULT_MAX_BATCH;
> >  max_batch = MIN_NON_ZERO(MAX_EVENTS - s->io_q.in_flight + s->io_q.in_queue, max_batch);
> > 
> 
> Since we will compare `in_queue` with `max_batch`, should we remove it from
> this expression?
> 
> I mean:
> 
>   int64_t max_batch = s->aio_context->aio_max_batch ?: DEFAULT_MAX_BATCH;
>   max_batch = MIN_NON_ZERO(MAX_EVENTS - s->io_q.in_flight, max_batch);
> 
> then as it is in this patch:
> 
>   s->io_q.in_queue++;
>   if (!s->io_q.blocked &&
>       (!s->io_q.plugged ||
>        s->io_q.in_queue >= max_batch)) {
>       ioq_submit(s);
>   }

Good.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

      reply	other threads:[~2021-07-20 10:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07 15:00 [PATCH 0/3] linux-aio: limit the batch size to reduce queue latency Stefano Garzarella
2021-07-07 15:00 ` [PATCH 1/3] iothread: generalize iothread_set_param/iothread_get_param Stefano Garzarella
2021-07-07 15:00 ` [PATCH 2/3] iothread: add aio-max-batch parameter Stefano Garzarella
2021-07-13 14:51   ` Stefan Hajnoczi
2021-07-19 10:10     ` Stefano Garzarella
2021-07-07 15:00 ` [PATCH 3/3] linux-aio: limit the batch size using `aio-max-batch` parameter Stefano Garzarella
2021-07-13 14:58   ` Stefan Hajnoczi
2021-07-19 10:35     ` Stefano Garzarella
2021-07-20 10: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=YPaoXutDKwmekoew@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=fam@euphon.net \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.com \
    --cc=sw@weilnetz.de \
    /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).