All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
To: stefanha@redhat.com, famz@redhat.com, jcody@redhat.com,
	kwolf@redhat.com, mreitz@redhat.com
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org,
	yjs-kernel@cmss.chinamobile.com,
	Yaowei Bai <baiyaowei@cmss.chinamobile.com>
Subject: [Qemu-devel] [PATCH 2/2] aio: improve aio_poll performance by checking epoll only once
Date: Wed, 14 Sep 2016 07:03:39 -0400	[thread overview]
Message-ID: <1473851019-7005-3-git-send-email-baiyaowei@cmss.chinamobile.com> (raw)
In-Reply-To: <1473851019-7005-1-git-send-email-baiyaowei@cmss.chinamobile.com>

As epoll whether enabled or not is a global setting, we can just
check it only once rather than checking it with every node iteration.
Through this we can avoid a lot of checks when epoll is not enabled.

Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
Reviewed-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
---
 aio-posix.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/aio-posix.c b/aio-posix.c
index 43162a9..4ef34dd 100644
--- a/aio-posix.c
+++ b/aio-posix.c
@@ -431,11 +431,13 @@ bool aio_poll(AioContext *ctx, bool blocking)
     assert(npfd == 0);
 
     /* fill pollfds */
-    QLIST_FOREACH(node, &ctx->aio_handlers, node) {
-        if (!node->deleted && node->pfd.events
-            && !aio_epoll_enabled(ctx)
-            && aio_node_check(ctx, node->is_external)) {
-            add_pollfd(node);
+
+    if (!aio_epoll_enabled(ctx)) {
+        QLIST_FOREACH(node, &ctx->aio_handlers, node) {
+            if (!node->deleted && node->pfd.events
+                && aio_node_check(ctx, node->is_external)) {
+                add_pollfd(node);
+            }
         }
     }
 
-- 
1.8.3.1

  parent reply	other threads:[~2016-09-14  9:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-14 11:03 [Qemu-devel] [PATCH 0/2] improve aio_poll performance Yaowei Bai
2016-09-14 11:03 ` [Qemu-devel] [PATCH 1/2] block: mirror: fix wrong comment of mirror_start Yaowei Bai
2016-09-14 17:04   ` Eric Blake
2016-09-14 11:03 ` Yaowei Bai [this message]
2016-09-14 16:40   ` [Qemu-devel] [PATCH 2/2] aio: improve aio_poll performance by checking epoll only once Stefan Hajnoczi
2016-09-18  1:32     ` Yaowei Bai
2016-09-19 15:36 ` [Qemu-devel] [PATCH 0/2] improve aio_poll performance Stefan Hajnoczi

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=1473851019-7005-3-git-send-email-baiyaowei@cmss.chinamobile.com \
    --to=baiyaowei@cmss.chinamobile.com \
    --cc=famz@redhat.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=yjs-kernel@cmss.chinamobile.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 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.