gvisor/pkg/fdnotifier
Jamie Liu 16a6afe48f Yield P after notifying event waiters in fdnotifier.
The fdnotifier goroutine alternates between [host] epoll_wait()ing for I/O
readiness events and propagating those events through the sentry, possibly
waking task goroutines blocked in e.g. [application] epoll_wait(). Since woken
goroutines are queued on the runqueue of the waking P (cf. runtime.ready()),
these goroutines will almost always wait to execute until another OS thread
takes them (either directly via runtime.runqsteal(), or indirectly via sysmon
stealing the P and runtime.handoffp()ing it to another thread). Furthermore,
epoll_wait() is most likely to block (new events are least likely to have
arrived) shortly after a previous call (on the same epoll FD) returns events,
so this behavior utilizes the thread's OS-scheduled time slice poorly. Avoid
both of these problems by runtime.goyield()ing between goroutine wakeup and
epoll_wait().

PiperOrigin-RevId: 430793631
2022-02-24 14:30:32 -08:00
..
BUILD
fdnotifier.go Yield P after notifying event waiters in fdnotifier. 2022-02-24 14:30:32 -08:00
poll_unsafe.go