From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Ming Lei <ming.lei@canonical.com>,
qemu-devel <qemu-devel@nongnu.org>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH for-2.1?!?] AioContext: speed up aio_notify
Date: Fri, 04 Jul 2014 08:51:18 +0200 [thread overview]
Message-ID: <53B64EE6.4000705@redhat.com> (raw)
In-Reply-To: <CAJSP0QVL6=vcARiwGkS-iBREji+CynQO_NT-doZtmqF7ba7Y1Q@mail.gmail.com>
Il 03/07/2014 20:17, Stefan Hajnoczi ha scritto:
> On Thu, Jul 3, 2014 at 6:59 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> Looks like a very interesting optimization for the block layer. If we
> can get some performance results - especially how it improves the
> virtio-blk dataplane regression - maybe we should merge it for 2.1.
>
>> @@ -247,9 +248,22 @@ ThreadPool *aio_get_thread_pool(AioContext *ctx)
>> return ctx->thread_pool;
>> }
>>
>> +void aio_set_dispatching(AioContext *ctx, bool dispatching)
>> +{
>> + ctx->dispatching = dispatching;
>> + /* Write ctx->dispatching before reading e.g. bh->scheduled. */
>> + if (!dispatching) {
>> + smp_mb();
>> + }
>
> Is the if statement necessary? It seems like an optimization to avoid
> the memory barrier in 50% of the calls.
Yes.
> But by avoiding the barrier it could cause other threads to "miss" the
> dispatching period on machines with weak memory models. I guess
> that's fine since we're not trying to optimize other threads but more
> focussing on callers from the event loop's own thread.
>
> Anyway, the if statement makes this function trickier than it has to
> be IMO. Want to drop it?
I think this is the last "trickiness" problem of this patch, but of
course I have no problem removing it if the patch goes into 2.1. Ming
Lei's latest message suggests it is not necessary though.
The patch should be tested at least on rbd or gluster, these are the
main users of remote-thread notification via bottom halves.
Paolo
next prev parent reply other threads:[~2014-07-04 6:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-03 16:59 [Qemu-devel] [PATCH for-2.1?!?] AioContext: speed up aio_notify Paolo Bonzini
2014-07-03 18:17 ` Stefan Hajnoczi
2014-07-04 6:51 ` Paolo Bonzini [this message]
2014-07-04 7:23 ` Ming Lei
2014-07-04 7:27 ` Paolo Bonzini
2014-07-04 10:26 ` Kevin Wolf
2014-07-04 10:40 ` Paolo Bonzini
2014-07-07 8:28 ` Stefan Hajnoczi
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=53B64EE6.4000705@redhat.com \
--to=pbonzini@redhat.com \
--cc=kwolf@redhat.com \
--cc=ming.lei@canonical.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
--cc=stefanha@redhat.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 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).