linux: don't use io_uring on pre-5.10.186 kernels (#4093)

Those kernels have a known resource consumption bug where the sqpoll
thread busy-loops.

Fixes: https://github.com/libuv/libuv/issues/4089
This commit is contained in:
Ben Noordhuis 2023-07-12 23:33:49 +02:00 committed by GitHub
parent 1230fad8f4
commit 50b53cbd0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -431,8 +431,14 @@ static int uv__use_io_uring(void) {
use = atomic_load_explicit(&use_io_uring, memory_order_relaxed);
if (use == 0) {
/* Older kernels have a bug where the sqpoll thread uses 100% CPU. */
use = uv__kernel_version() >= /* 5.10.186 */ 0x050ABA ? 1 : -1;
/* But users can still enable it if they so desire. */
val = getenv("UV_USE_IO_URING");
use = val == NULL || atoi(val) ? 1 : -1;
if (val != NULL)
use = atoi(val) ? 1 : -1;
atomic_store_explicit(&use_io_uring, use, memory_order_relaxed);
}