Commit 6074d558229684901693c6107e760fcff47a2d44

Andy Pan 2024-04-17T10:36:47

Avoid calling read(2) on eventfd on each event-loop wakeup Register the eventfd with EPOLLET to enable edge-triggered notification where we don't need to read the data from the eventfd for every wakeup event. When the eventfd counter reaches the maximum value of the unsigned 64-bit, we rewind the counter and retry again. This optimization saves one system call on each event-loop wakeup, which eliminates the extra latency for epoll as the EVFILT_USER filter does for the kqueue.