eventpoll: add support for min-wait
authorJens Axboe <axboe@kernel.dk>
Fri, 19 Aug 2022 03:00:18 +0000 (21:00 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 1 Dec 2022 18:01:12 +0000 (11:01 -0700)
commit67c6e1c9a12e2ea23f70e1d13b2dd1476090adea
treecd16a79783f3f8db4a952ee486487d65390773c9
parent3fe64a3a96d4fcfba38f376e434ce251f6183943
eventpoll: add support for min-wait

This adds the necessary infrastructure to support a minimum wait for
reaping events, API for setting or applying a minimum wait will come
in the following patches.

For medium workload efficiencies, some production workloads inject
artificial timers or sleeps before calling epoll_wait() to get
better batching and higher efficiencies. While this does help, it's
not as efficient as it could be. By adding support for epoll_wait()
for this directly, we can avoids extra context switches and scheduler
and timer overhead.

As an example, running an AB test on an identical workload at about
~370K reqs/second, without this change and with the sleep hack
mentioned above (using 200 usec as the timeout), we're doing 310K-340K
non-voluntary context switches per second. Idle CPU on the host is 27-34%.
With the the sleep hack removed and epoll set to the same 200 usec
value, we're handling the exact same load but at 292K-315k non-voluntary
context switches and idle CPU of 33-41%, a substantial win.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/eventpoll.c