From: Markus Armbruster <armbru@redhat.com>
To: JAEHOON KIM <jhkim@linux.ibm.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
mjrosato@linux.ibm.com, farman@linux.ibm.com,
pbonzini@redhat.com, stefanha@redhat.com, fam@euphon.net,
eblake@redhat.com, berrange@redhat.com, eduardo@habkost.net,
dave@treblig.org, sw@weilnetz.de
Subject: Re: [PATCH RFC v2 3/3] qapi/iothread: introduce poll-weight parameter for aio-poll
Date: Fri, 27 Mar 2026 06:49:02 +0100 [thread overview]
Message-ID: <871ph5ddpt.fsf@pond.sub.org> (raw)
In-Reply-To: <738e8d90-b08f-4ded-bd8d-3155a665a725@linux.ibm.com> (JAEHOON KIM's message of "Thu, 26 Mar 2026 10:55:19 -0500")
JAEHOON KIM <jhkim@linux.ibm.com> writes:
> On 3/25/2026 9:04 AM, Markus Armbruster wrote:
>> 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>
[...]
>>> diff --git a/qapi/qom.json b/qapi/qom.json
>>> index c653248f85..feb80b6cfe 100644
>>> --- a/qapi/qom.json
>>> +++ b/qapi/qom.json
>>> @@ -606,6 +606,11 @@
>>> # 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 current event interval contributes to
>>> +# the next polling time calculation. Valid values are 1 or
>>> +# greater. If set to 0, the default value of 3 is used.
>>
>> The commit message hints what the valid values mean, the doc comment
>> doesn't even that. Do users need to know?
>>
>> Code [*] below uses it like time >> poll_weight, where @time is int64_t.
>> poll_weight > 63 is undefined behavior, which is a no-no. Please reject
>> such values. poll_weight == 64 results in zero. Is that useful?
>>
>> Missing: (default: 0) (since 11.1)
>
> I agree. I will update the doc comment to give users a practical hint,
> for example like this:
>
> # @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)
Better, thanks!
> I will also a check in the code so that values exceeding the maximum
> allowed will revert to the system default.
Don't silently "correct" invalid input, reject it!
[...]
next prev parent reply other threads:[~2026-03-27 5:50 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 13:54 [PATCH RFC v2 0/3] improve aio-polling efficiency Jaehoon Kim
2026-03-23 13:54 ` [PATCH RFC v2 1/3] aio-poll: avoid unnecessary polling time computation Jaehoon Kim
2026-03-25 17:22 ` Stefan Hajnoczi
2026-03-26 18:17 ` JAEHOON KIM
2026-03-26 18:34 ` Stefan Hajnoczi
2026-03-23 13:54 ` [PATCH RFC v2 2/3] aio-poll: refine iothread polling using weighted handler intervals Jaehoon Kim
2026-03-25 20:37 ` Stefan Hajnoczi
2026-03-27 5:02 ` JAEHOON KIM
2026-03-30 19:17 ` Stefan Hajnoczi
2026-03-31 20:42 ` JAEHOON KIM
2026-03-23 13:54 ` [PATCH RFC v2 3/3] qapi/iothread: introduce poll-weight parameter for aio-poll Jaehoon Kim
2026-03-25 14:04 ` Markus Armbruster
2026-03-26 15:55 ` JAEHOON KIM
2026-03-27 5:49 ` Markus Armbruster [this message]
2026-03-27 14:23 ` JAEHOON KIM
2026-03-25 16:52 ` Stefan Hajnoczi
2026-03-25 16:56 ` Stefan Hajnoczi
2026-03-26 16:13 ` 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=871ph5ddpt.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.