[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/13] fdmon-poll: reset npfd when upgrading to fdmon-epoll
From: |
Stefan Hajnoczi |
Subject: |
[PULL 11/13] fdmon-poll: reset npfd when upgrading to fdmon-epoll |
Date: |
Wed, 23 Sep 2020 17:10:29 +0100 |
npfd keeps track of how many pollfds are currently being monitored. It
must be reset to 0 when fdmon_poll_wait() returns.
When npfd reaches a treshold we switch to fdmon-epoll because it scales
better.
This patch resets npfd in the case where we switch to fdmon-epoll.
Forgetting to do so results in the following assertion failure:
util/fdmon-poll.c:65: fdmon_poll_wait: Assertion `npfd == 0' failed.
Fixes: 1f050a4690f62a1e7dabc4f44141e9f762c3769f ("aio-posix: extract ppoll(2)
and epoll(7) fd monitoring")
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1869952
Message-Id: <20200915120339.702938-2-stefanha@redhat.com>
---
util/fdmon-poll.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/util/fdmon-poll.c b/util/fdmon-poll.c
index 488067b679..5fe3b47865 100644
--- a/util/fdmon-poll.c
+++ b/util/fdmon-poll.c
@@ -73,6 +73,7 @@ static int fdmon_poll_wait(AioContext *ctx, AioHandlerList
*ready_list,
/* epoll(7) is faster above a certain number of fds */
if (fdmon_epoll_try_upgrade(ctx, npfd)) {
+ npfd = 0; /* we won't need pollfds[], reset npfd */
return ctx->fdmon_ops->wait(ctx, ready_list, timeout);
}
--
2.26.2
- [PULL 01/13] MAINTAINERS: add Stefan Hajnoczi as block/nvme.c maintainer, (continued)
- [PULL 01/13] MAINTAINERS: add Stefan Hajnoczi as block/nvme.c maintainer, Stefan Hajnoczi, 2020/09/23
- [PULL 03/13] virtio: add vhost-user-fs-ccw device, Stefan Hajnoczi, 2020/09/23
- [PULL 02/13] libvhost-user: handle endianness as mandated by the spec, Stefan Hajnoczi, 2020/09/23
- [PULL 04/13] util/iov: add iov_discard_undo(), Stefan Hajnoczi, 2020/09/23
- [PULL 06/13] virtio-crypto: don't modify elem->in/out_sg, Stefan Hajnoczi, 2020/09/23
- [PULL 07/13] docs/system: clarify deprecation schedule, Stefan Hajnoczi, 2020/09/23
- [PULL 05/13] virtio-blk: undo destructive iov_discard_*() operations, Stefan Hajnoczi, 2020/09/23
- [PULL 09/13] gitmodules: switch to qemu.org meson mirror, Stefan Hajnoczi, 2020/09/23
- [PULL 08/13] gitmodules: switch to qemu.org qboot mirror, Stefan Hajnoczi, 2020/09/23
- [PULL 10/13] gitmodules: add qemu.org vbootrom submodule, Stefan Hajnoczi, 2020/09/23
- [PULL 11/13] fdmon-poll: reset npfd when upgrading to fdmon-epoll,
Stefan Hajnoczi <=
- [PULL 12/13] tests: add test-fdmon-epoll, Stefan Hajnoczi, 2020/09/23
- [PULL 13/13] qemu/atomic.h: rename atomic_ to qatomic_, Stefan Hajnoczi, 2020/09/23
- Re: [PULL 00/13] Block patches, no-reply, 2020/09/23
- Re: [PULL 00/13] Block patches, Peter Maydell, 2020/09/25