golang/go

runtime: use epoll_pwait2 where available for sub-millisecond timeout precision on Linux

Open

#53,824 opened on Jul 13, 2022

View on GitHub
 (26 comments) (11 reactions) (2 assignees)Go (19,008 forks)batch import
NeedsFixPerformancecompiler/runtimehelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Linux kernel 5.11 (February, 2021) added the epoll_pwait2 system call. It is exactly like epoll_pwait except that the timeout argument is a struct timespec. This permits specifying a timeout with nanosecond precision, where epoll_pwait and epoll_wait only permit millisecond precision. We should change runtime/netpoll_epoll.go to use epoll_pwait2 when available to get higher precision delays.

CC @golang/runtime

Contributor guide