qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] aio-posix: split poll check from ready handler


From: Stefano Garzarella
Subject: Re: [PATCH] aio-posix: split poll check from ready handler
Date: Thu, 2 Dec 2021 15:39:13 +0100

On Thu, Dec 02, 2021 at 01:09:23PM +0000, Stefan Hajnoczi wrote:
On Wed, Dec 01, 2021 at 12:55:08PM +0100, Stefano Garzarella wrote:
On Tue, Nov 30, 2021 at 11:20:57AM +0000, Stefan Hajnoczi wrote:
> @@ -657,10 +704,7 @@ bool aio_poll(AioContext *ctx, bool blocking)
>     }
>
>     progress |= aio_bh_poll(ctx);
> -
> -    if (ret > 0) {
> -        progress |= aio_dispatch_ready_handlers(ctx, &ready_list);
> -    }
> +    progress |= aio_dispatch_ready_handlers(ctx, &ready_list);

I honestly don't know this code well, so this change isn't clear to me.

IIUC this is necessary because we now use REVENTS_POLL_READY, so even if
`wait` is interrupted, we want to run the handlers ready so far.
Or maybe is it an unrelated optimization?

Previously we didn't need to run aio_dispatch_ready_handlers() in
polling mode (ret would be 0). Now we do, so the conditional needs to be
removed.

There is no change for the ctx->fdmon_ops->wait() -EINTR case. fdmon
won't add handlers to ready_list when returning -EINTR and previously
polling would run handlers immediately. In order to preserve that
behavior we now need to call aio_dispatch_ready_handlers()
unconditionally because polling may have added handlers.

Yeah, now I see.
Aside from not knowing the code, I had only considered the ret < 0 case.

Thanks for clarifying,
Stefano




reply via email to

[Prev in Thread] Current Thread [Next in Thread]