diff options
| author | Stefan Hajnoczi <stefanha@redhat.com> | 2020-02-14 17:17:12 +0000 |
|---|---|---|
| committer | Stefan Hajnoczi <stefanha@redhat.com> | 2020-02-22 08:26:47 +0000 |
| commit | 7391d34c3cca09c0bb0140275839c6619b86ec0f (patch) | |
| tree | d0ba9fcdcb26b681cb76cfdf31ccdf9a6330d473 /scripts/checkpatch.pl | |
| parent | 4749079ce033a94784cbe20a661abeac598ff057 (diff) | |
| download | focaccia-qemu-7391d34c3cca09c0bb0140275839c6619b86ec0f.tar.gz focaccia-qemu-7391d34c3cca09c0bb0140275839c6619b86ec0f.zip | |
aio-posix: make AioHandler dispatch O(1) with epoll
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 <stefanha@redhat.com> Reviewed-by: Sergio Lopez <slp@redhat.com> Message-id: 20200214171712.541358-6-stefanha@redhat.com [Fix compilation error on macOS where there is no epoll(87). The aio_epoll() prototype was out of date and aio_add_ready_list() needed to be moved outside the ifdef. --Stefan] Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'scripts/checkpatch.pl')
0 files changed, 0 insertions, 0 deletions