From: Chao Gao <chao.gao@intel.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: fam@euphon.net, pbonzini@redhat.com, qemu-block@nongnu.org,
qemu-devel@nongnu.org
Subject: Re: [RFC v1] util/aio: Keep notification disabled as much as possible
Date: Thu, 7 Jul 2022 18:16:48 +0800 [thread overview]
Message-ID: <20220707101641.GA5461@gao-cwp> (raw)
In-Reply-To: <Ysahl6A7ZDyt7TFX@stefanha-x1.localdomain>
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>
prev parent reply other threads:[~2022-07-07 10:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-01 9:13 [RFC v1] util/aio: Keep notification disabled as much as possible Chao Gao
2022-07-06 11:59 ` Stefan Hajnoczi
2022-07-06 14:12 ` Chao Gao
2022-07-07 9:04 ` Stefan Hajnoczi
2022-07-07 10:16 ` Chao Gao [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=20220707101641.GA5461@gao-cwp \
--to=chao.gao@intel.com \
--cc=fam@euphon.net \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--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).