[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/2] AioContext: optimize clearing the EventNoti
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 2/2] AioContext: optimize clearing the EventNotifier |
Date: |
Mon, 20 Jul 2015 07:34:31 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 |
On 20/07/2015 07:25, Paolo Bonzini wrote:
> > /* fill pollfds */
> > + i = 0;
> > QLIST_FOREACH(node, &ctx->aio_handlers, node) {
> > if (!node->deleted && node->pfd.events) {
> > add_pollfd(node);
> > + if (node->pfd.fd == event_notifier_get_fd(&ctx->notifier)) {
> > + assert(aio_notifier_idx == -1);
> > + aio_notifier_idx = i;
> > + }
> > + i++;
> > }
> > }
>
> That's a good idea. Since aio_set_fd_handler uses QLIST_INSERT_HEAD,
> perhaps we can be sure that aio_notifier_idx is always the last one
> (i.e. i-1)? And the same can be done on Windows, I think.
BTW, if this is not true I think I prefer the optimization with atomics.
But if it's true that we can just use i-1, this one is better.
Paolo