From: Markus Armbruster <armbru@redhat.com>
To: Jaehoon Kim <jhkim@linux.ibm.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
pbonzini@redhat.com, stefanha@redhat.com, fam@euphon.net,
eblake@redhat.com, berrange@redhat.com, eduardo@habkost.net,
dave@treblig.org, sw@weilnetz.de, mjrosato@linux.ibm.com,
farman@linux.ibm.com
Subject: Re: [PATCH v3 3/3] qapi/iothread: introduce poll-weight parameter for aio-poll
Date: Thu, 16 Apr 2026 16:54:19 +0200 [thread overview]
Message-ID: <87eckfq7l0.fsf@pond.sub.org> (raw)
In-Reply-To: <20260405200735.3075407-4-jhkim@linux.ibm.com> (Jaehoon Kim's message of "Sun, 5 Apr 2026 15:07:34 -0500")
Jaehoon Kim <jhkim@linux.ibm.com> writes:
> Introduce a configurable poll-weight parameter for adaptive polling
> in IOThread. This parameter replaces the hardcoded POLL_WEIGHT_SHIFT
> constant, allowing runtime control over how much the most recent
> event interval affects the next polling duration calculation.
>
> The poll-weight parameter uses a shift value where larger values
> decrease the weight of the current interval, enabling more gradual
> adjustments. When set to 0, a default value of 3 is used (meaning
> the current interval contributes approximately 1/8 to the weighted
> average).
>
> This patch also removes the hardcoded default values for poll-grow
> and poll-shrink parameters from the grow_polling_time() and
> shrink_polling_time() functions, as these defaults are now properly
> initialized in iothread.c during IOThread creation.
>
> Signed-off-by: Jaehoon Kim <jhkim@linux.ibm.com>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[...]
> diff --git a/qapi/misc.json b/qapi/misc.json
> index 28c641fe2f..554b0c5717 100644
> --- a/qapi/misc.json
> +++ b/qapi/misc.json
> @@ -85,6 +85,12 @@
Note: this is IOThreadInfo, used only as return value of
query-iothreads.
> # @poll-shrink: how many ns will be removed from polling time, 0 means
> # that it's not configured (since 2.9)
> #
> +# @poll-weight: the weight factor for adaptive polling.
> +# Determines how much the current event interval contributes to
> +# the next polling time calculation. Valid values are 1 or
> +# greater. 0 selects the system default value which is currently
> +# 3 (since 11.1)
As far as I can tell, query-iothreads never returns "poll-weight": 0.
So, scratch the last sentence.
> +#
> # @aio-max-batch: maximum number of requests in a batch for the AIO
> # engine, 0 means that the engine will use its default (since 6.1)
> #
> @@ -96,6 +102,7 @@
> 'poll-max-ns': 'int',
> 'poll-grow': 'int',
> 'poll-shrink': 'int',
> + 'poll-weight': 'int',
> 'aio-max-batch': 'int' } }
>
> ##
> diff --git a/qapi/qom.json b/qapi/qom.json
> index c653248f85..dd45ac1087 100644
> --- a/qapi/qom.json
> +++ b/qapi/qom.json
> @@ -606,6 +606,13 @@
> # algorithm detects it is spending too long polling without
> # encountering events. 0 selects a default behaviour (default: 0)
> #
> +# @poll-weight: the weight factor for adaptive polling. Determines
> +# how much the most recent event interval affects the next
> +# polling duration calculation. If set to 0, the system default
> +# value of 3 is used. Typical values: 1 (high weight on recent
> +# interval), 2-4 (moderate weight on recent interval).
> +# (default: 0) (since 11.1)
> +#
> # The @aio-max-batch option is available since 6.1.
> #
> # Since: 2.0
> @@ -614,7 +621,8 @@
> 'base': 'EventLoopBaseProperties',
> 'data': { '*poll-max-ns': 'int',
> '*poll-grow': 'int',
> - '*poll-shrink': 'int' } }
> + '*poll-shrink': 'int',
> + '*poll-weight': 'int' } }
>
> ##
> # @MainLoopProperties:
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 69e5a874c1..8ddf6c8d36 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -6413,7 +6413,7 @@ SRST
>
> CN=laptop.example.com,O=Example Home,L=London,ST=London,C=GB
>
> - ``-object iothread,id=id,poll-max-ns=poll-max-ns,poll-grow=poll-grow,poll-shrink=poll-shrink,aio-max-batch=aio-max-batch``
> + ``-object iothread,id=id,poll-max-ns=poll-max-ns,poll-grow=poll-grow,poll-shrink=poll-shrink,poll-weight=poll-weight,aio-max-batch=aio-max-batch``
> Creates a dedicated event loop thread that devices can be
> assigned to. This is known as an IOThread. By default device
> emulation happens in vCPU threads or the main event loop thread.
> @@ -6449,6 +6449,11 @@ SRST
> the polling time when the algorithm detects it is spending too
> long polling without encountering events.
>
> + The ``poll-weight`` parameter is the weight factor used in the
> + adaptive polling algorithm. It determines how much the most
> + recent event interval affects the calculation of the next
> + polling duration.
This is now less detailed than the version in qom.json. Care to add the
details here, too?
> +
> The ``aio-max-batch`` parameter is the maximum number of requests
> in a batch for the AIO engine, 0 means that the engine will use
> its default.
[...]
next prev parent reply other threads:[~2026-04-16 14:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-05 20:07 [PATCH v3 0/3] improve aio-polling efficiency Jaehoon Kim
2026-04-05 20:07 ` [PATCH v3 1/3] aio-poll: avoid unnecessary polling time computation Jaehoon Kim
2026-04-05 20:07 ` [PATCH v3 2/3] aio-poll: refine iothread polling using weighted handler intervals Jaehoon Kim
2026-04-05 20:07 ` [PATCH v3 3/3] qapi/iothread: introduce poll-weight parameter for aio-poll Jaehoon Kim
2026-04-16 14:54 ` Markus Armbruster [this message]
2026-04-17 14:48 ` JAEHOON KIM
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=87eckfq7l0.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=dave@treblig.org \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=fam@euphon.net \
--cc=farman@linux.ibm.com \
--cc=jhkim@linux.ibm.com \
--cc=mjrosato@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=sw@weilnetz.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.