Skip to content

Commit 50b53cb

Browse files
authored
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: libuv/libuv#4089
1 parent 1230fad commit 50b53cb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/unix/linux.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,14 @@ static int uv__use_io_uring(void) {
431431
use = atomic_load_explicit(&use_io_uring, memory_order_relaxed);
432432

433433
if (use == 0) {
434+
/* Older kernels have a bug where the sqpoll thread uses 100% CPU. */
435+
use = uv__kernel_version() >= /* 5.10.186 */ 0x050ABA ? 1 : -1;
436+
437+
/* But users can still enable it if they so desire. */
434438
val = getenv("UV_USE_IO_URING");
435-
use = val == NULL || atoi(val) ? 1 : -1;
439+
if (val != NULL)
440+
use = atoi(val) ? 1 : -1;
441+
436442
atomic_store_explicit(&use_io_uring, use, memory_order_relaxed);
437443
}
438444

0 commit comments

Comments
 (0)