{"id":2230453,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2230453/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260429182127.219776-2-stefanha@redhat.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.1/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260429182127.219776-2-stefanha@redhat.com>","date":"2026-04-29T18:21:25","name":"[PULL,1/3] aio-poll: avoid unnecessary polling time computation","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"e1a43bd44d6e67dce16bf780ce33eb2333a9330d","submitter":{"id":17227,"url":"http://patchwork.ozlabs.org/api/1.1/people/17227/?format=json","name":"Stefan Hajnoczi","email":"stefanha@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260429182127.219776-2-stefanha@redhat.com/mbox/","series":[{"id":502128,"url":"http://patchwork.ozlabs.org/api/1.1/series/502128/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=502128","date":"2026-04-29T18:21:24","name":"[PULL,1/3] aio-poll: avoid unnecessary polling time computation","version":1,"mbox":"http://patchwork.ozlabs.org/series/502128/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2230453/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2230453/checks/","tags":{},"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=U07uF+Gi;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5Qf200fBz1xqf\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 04:23:05 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wI9Xr-0002fH-4u; Wed, 29 Apr 2026 14:21:59 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <stefanha@redhat.com>)\n id 1wI9Xd-0002cW-NA\n for qemu-devel@nongnu.org; Wed, 29 Apr 2026 14:21:47 -0400","from us-smtp-delivery-124.mimecast.com ([170.10.129.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <stefanha@redhat.com>)\n id 1wI9XY-0003he-PU\n for qemu-devel@nongnu.org; Wed, 29 Apr 2026 14:21:42 -0400","from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-295-FgJw67dJMraYE63242TgqA-1; Wed,\n 29 Apr 2026 14:21:38 -0400","from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 8AF171800652; Wed, 29 Apr 2026 18:21:36 +0000 (UTC)","from localhost (unknown [10.44.33.46])\n by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 5E759195608E; Wed, 29 Apr 2026 18:21:34 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1777486899;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=6iFIOBsqvi6+k9V427YKtoDvLloAhnlHP+JZ25es5R8=;\n b=U07uF+GiM7s3oB6S2QiwYU2OEds8xXoysnZGD3qmb9RLuP6+tr/fy6av5Baz4ctKeV9gLR\n oZAMn9K128p4uzAy+II5L4ESj01BLcPao1pS997h9pKyBsDFvewA33uvQ6qigEuIYvtavd\n upJESFtIwv3mLoyu54z+317g5EsXAUY=","X-MC-Unique":"FgJw67dJMraYE63242TgqA-1","X-Mimecast-MFC-AGG-ID":"FgJw67dJMraYE63242TgqA_1777486896","From":"Stefan Hajnoczi <stefanha@redhat.com>","To":"qemu-devel@nongnu.org","Cc":"Stefan Weil <sw@weilnetz.de>, Hanna Reitz <hreitz@redhat.com>,\n Peter Maydell <peter.maydell@linaro.org>, Kevin Wolf <kwolf@redhat.com>,\n Markus Armbruster <armbru@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>,\n qemu-block@nongnu.org, \"Dr. David Alan Gilbert\" <dave@treblig.org>,\n Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <fam@euphon.net>,\n \"Michael S. Tsirkin\" <mst@redhat.com>,\n =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= <berrange@redhat.com>,\n Eric Blake <eblake@redhat.com>, Jaehoon Kim <jhkim@linux.ibm.com>","Subject":"[PULL 1/3] aio-poll: avoid unnecessary polling time computation","Date":"Wed, 29 Apr 2026 14:21:25 -0400","Message-ID":"<20260429182127.219776-2-stefanha@redhat.com>","In-Reply-To":"<20260429182127.219776-1-stefanha@redhat.com>","References":"<20260429182127.219776-1-stefanha@redhat.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Scanned-By":"MIMEDefang 3.0 on 10.30.177.17","Received-SPF":"pass client-ip=170.10.129.124;\n envelope-from=stefanha@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com","X-Spam_score_int":"-20","X-Spam_score":"-2.1","X-Spam_bar":"--","X-Spam_report":"(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,\n SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"From: Jaehoon Kim <jhkim@linux.ibm.com>\n\nNodes are no longer added to poll_aio_handlers when adaptive polling is\ndisabled, preventing unnecessary try_poll_mode() calls. This avoids\niterating over all nodes to compute max_ns unnecessarily when polling\nis disabled.\n\nSigned-off-by: Jaehoon Kim <jhkim@linux.ibm.com>\nReviewed-by: Stefan Hajnoczi <stefanha@redhat.com>\nMessage-ID: <20260423195918.661299-2-jhkim@linux.ibm.com>\nSigned-off-by: Stefan Hajnoczi <stefanha@redhat.com>\n---\n util/aio-posix.c | 11 ++++++-----\n 1 file changed, 6 insertions(+), 5 deletions(-)","diff":"diff --git a/util/aio-posix.c b/util/aio-posix.c\nindex 488d964611..351847c6fb 100644\n--- a/util/aio-posix.c\n+++ b/util/aio-posix.c\n@@ -307,9 +307,8 @@ static bool aio_dispatch_handler(AioContext *ctx, AioHandler *node)\n      * fdmon_supports_polling(), but only until the fd fires for the first\n      * time.\n      */\n-    if (!QLIST_IS_INSERTED(node, node_deleted) &&\n-        !QLIST_IS_INSERTED(node, node_poll) &&\n-        node->io_poll) {\n+    if (ctx->poll_max_ns && !QLIST_IS_INSERTED(node, node_deleted) &&\n+        !QLIST_IS_INSERTED(node, node_poll) && node->io_poll) {\n         trace_poll_add(ctx, node, node->pfd.fd, revents);\n         if (ctx->poll_started && node->io_poll_begin) {\n             node->io_poll_begin(node->opaque);\n@@ -631,7 +630,7 @@ static void adjust_polling_time(AioContext *ctx, AioPolledEvent *poll,\n bool aio_poll(AioContext *ctx, bool blocking)\n {\n     AioHandlerList ready_list = QLIST_HEAD_INITIALIZER(ready_list);\n-    bool progress;\n+    bool progress = false;\n     bool use_notify_me;\n     int64_t timeout;\n     int64_t start = 0;\n@@ -656,7 +655,9 @@ bool aio_poll(AioContext *ctx, bool blocking)\n     }\n \n     timeout = blocking ? aio_compute_timeout(ctx) : 0;\n-    progress = try_poll_mode(ctx, &ready_list, &timeout);\n+    if (ctx->poll_max_ns != 0) {\n+        progress = try_poll_mode(ctx, &ready_list, &timeout);\n+    }\n     assert(!(timeout && progress));\n \n     /*\n","prefixes":["PULL","1/3"]}