[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 2/7] aio-posix: avoid unnecessary aio_epoll_enabled()
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 2/7] aio-posix: avoid unnecessary aio_epoll_enabled() calls |
Date: |
Wed, 28 Sep 2016 19:15:32 +0100 |
From: Yaowei Bai <address@hidden>
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 <address@hidden>
Reviewed-by: Xiubo Li <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
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);
+ }
}
}
--
2.7.4
- [Qemu-devel] [PULL 0/7] Block patches, Stefan Hajnoczi, 2016/09/28
- [Qemu-devel] [PULL 1/7] block: mirror: fix wrong comment of mirror_start, Stefan Hajnoczi, 2016/09/28
- [Qemu-devel] [PULL 2/7] aio-posix: avoid unnecessary aio_epoll_enabled() calls,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 5/7] coroutine: add qemu_coroutine_entered() function, Stefan Hajnoczi, 2016/09/28
- [Qemu-devel] [PULL 7/7] linux-aio: fix re-entrant completion processing, Stefan Hajnoczi, 2016/09/28
- [Qemu-devel] [PULL 4/7] libqos: fix qvring_init(), Stefan Hajnoczi, 2016/09/28
- [Qemu-devel] [PULL 3/7] iothread: check iothread->ctx before aio_context_unref to avoid assertion, Stefan Hajnoczi, 2016/09/28
- [Qemu-devel] [PULL 6/7] test-coroutine: test qemu_coroutine_entered(), Stefan Hajnoczi, 2016/09/28
- Re: [Qemu-devel] [PULL 0/7] Block patches, Peter Maydell, 2016/09/28