[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 5/5] aio-posix: make AioHandler dispatch O(1) with epoll
From: |
Sergio Lopez |
Subject: |
Re: [PATCH 5/5] aio-posix: make AioHandler dispatch O(1) with epoll |
Date: |
Wed, 19 Feb 2020 12:00:20 +0100 |
On Fri, Feb 14, 2020 at 05:17:12PM +0000, Stefan Hajnoczi wrote:
> File descriptor monitoring is O(1) with epoll(7), but
> aio_dispatch_handlers() still scans all AioHandlers instead of
> dispatching just those that are ready. This makes aio_poll() O(n) with
> respect to the total number of registered handlers.
>
> Add a local ready_list to aio_poll() so that each nested aio_poll()
> builds a list of handlers ready to be dispatched. Since file descriptor
> polling is level-triggered, nested aio_poll() calls also see fds that
> were ready in the parent but not yet dispatched. This guarantees that
> nested aio_poll() invocations will dispatch all fds, even those that
> became ready before the nested invocation.
>
> Since only handlers ready to be dispatched are placed onto the
> ready_list, the new aio_dispatch_ready_handlers() function provides O(1)
> dispatch.
>
> Note that AioContext polling is still O(n) and currently cannot be fully
> disabled. This still needs to be fixed before aio_poll() is fully O(1).
>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
> util/aio-posix.c | 106 +++++++++++++++++++++++++++++++++--------------
> 1 file changed, 76 insertions(+), 30 deletions(-)
Reviewed-by: Sergio Lopez <address@hidden>
signature.asc
Description: PGP signature
- [PATCH 0/5] aio-posix: towards an O(1) event loop, Stefan Hajnoczi, 2020/02/14
- [PATCH 1/5] aio-posix: fix use after leaving scope in aio_poll(), Stefan Hajnoczi, 2020/02/14
- [PATCH 2/5] aio-posix: don't pass ns timeout to epoll_wait(), Stefan Hajnoczi, 2020/02/14
- [PATCH 3/5] qemu/queue.h: add QLIST_SAFE_REMOVE(), Stefan Hajnoczi, 2020/02/14
- [PATCH 5/5] aio-posix: make AioHandler dispatch O(1) with epoll, Stefan Hajnoczi, 2020/02/14
- Re: [PATCH 5/5] aio-posix: make AioHandler dispatch O(1) with epoll,
Sergio Lopez <=
- Re: [PATCH 5/5] aio-posix: make AioHandler dispatch O(1) with epoll, Paolo Bonzini, 2020/02/19
- Re: [PATCH 5/5] aio-posix: make AioHandler dispatch O(1) with epoll, Stefan Hajnoczi, 2020/02/21
- Re: [PATCH 5/5] aio-posix: make AioHandler dispatch O(1) with epoll, Paolo Bonzini, 2020/02/21
- Re: [PATCH 5/5] aio-posix: make AioHandler dispatch O(1) with epoll, Stefan Hajnoczi, 2020/02/21
- Re: [PATCH 5/5] aio-posix: make AioHandler dispatch O(1) with epoll, Stefan Hajnoczi, 2020/02/21
- Re: [PATCH 5/5] aio-posix: make AioHandler dispatch O(1) with epoll, Paolo Bonzini, 2020/02/21
- Re: [PATCH 5/5] aio-posix: make AioHandler dispatch O(1) with epoll, Stefan Hajnoczi, 2020/02/21
- Re: [PATCH 5/5] aio-posix: make AioHandler dispatch O(1) with epoll, Paolo Bonzini, 2020/02/21
[PATCH 4/5] aio-posix: make AioHandler deletion O(1), Stefan Hajnoczi, 2020/02/14