The Linux event poll “epoll” code for efficient I/O multiplexing and monitoring of file descriptors for seeing when I/O is possible has a new optimization merged today for Linux 7.0.
Eric Dumazet of Google who has been involved in some great improvements to the Linux kernel has adapted the eventpoll’s epoll_put_uevent() code into a scoped user access for saving two function calls. Scoped user access functionality was introduced to the mainline kernel back in Linux 6.19. Scoped user access aims to reduce speculation barriers and the incurred performance penalty.
Dumazet found that this epoll_put_uevent() using scoped user access yielded around a 1.5% increase in a network packets per second (PPS) benchmark on AMD Zen 2 hardware.
“Saves two function calls, and one stac/clac pair.
stac/clac is rather expensive on older cpus like Zen 2.
A synthetic network stress test gives a ~1.5% increase of pps on AMD Zen 2.”
Other CPU families are likely to benefit too with this scoped user access usage not being anything Zen 2 specific but is likely to benefit older CPU generations more where the speculation barrier costs can be higher than with newer CPU generations.
In any event this now merged patch ahead of tomorrow’s Linux 7.0-rc3 release is a minor performance win for epoll while just adapting a few lines of code.
