[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC v1] util/aio: Keep notification disabled as much as possible
From: |
Chao Gao |
Subject: |
Re: [RFC v1] util/aio: Keep notification disabled as much as possible |
Date: |
Thu, 7 Jul 2022 18:16:48 +0800 |
User-agent: |
Mutt/1.9.4 (2018-02-28) |
On Thu, Jul 07, 2022 at 10:04:23AM +0100, Stefan Hajnoczi wrote:
>
>Does this patch solve the issue? The idea is to defer
>poll_set_started(false) for as long as possible.
Good idea! It is straightforward.
>
>diff --git a/util/aio-posix.c b/util/aio-posix.c
>index 731f3826c0..536f8b2534 100644
>--- a/util/aio-posix.c
>+++ b/util/aio-posix.c
>@@ -591,12 +591,6 @@ static bool try_poll_mode(AioContext *ctx, AioHandlerList
>*ready_list,
> return true;
> }
> }
>-
>- if (poll_set_started(ctx, ready_list, false)) {
>- *timeout = 0;
>- return true;
>- }
>-
> return false;
> }
>
>@@ -657,6 +651,11 @@ bool aio_poll(AioContext *ctx, bool blocking)
> * system call---a single round of run_poll_handlers_once suffices.
> */
> if (timeout || ctx->fdmon_ops->need_wait(ctx)) {
>+ if (poll_set_started(ctx, &ready_list, false)) {
>+ timeout = 0;
>+ progress = true;
In this case, is it ok to skip the call of ->wait() below? If yes, maybe put
the call in the "else" path.
>+ }
>+
> ctx->fdmon_ops->wait(ctx, &ready_list, timeout);
> }
>
Anyway,
Reviewed-by: Chao Gao <chao.gao@intel.com>
And my tests show your change works well. The number of notifications is
significantly reduced from ~80K/s to tens.
Tested-by: Chao Gao <chao.gao@intel.com>