diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/unix/internal.h | 3 | ||||
-rw-r--r-- | src/unix/linux.c | 8 | ||||
-rw-r--r-- | src/unix/loop.c | 8 |
3 files changed, 18 insertions, 1 deletions
diff --git a/src/unix/internal.h b/src/unix/internal.h index a8ff3909..8055730a 100644 --- a/src/unix/internal.h +++ b/src/unix/internal.h @@ -157,7 +157,8 @@ typedef struct uv__stream_queued_fds_s uv__stream_queued_fds_t; /* loop flags */ enum { UV_LOOP_BLOCK_SIGPROF = 0x1, - UV_LOOP_REAP_CHILDREN = 0x2 + UV_LOOP_REAP_CHILDREN = 0x2, + UV_LOOP_ENABLE_IO_URING_SQPOLL = 0x4 }; /* flags of excluding ifaddr */ diff --git a/src/unix/linux.c b/src/unix/linux.c index ad07430e..a5f74e89 100644 --- a/src/unix/linux.c +++ b/src/unix/linux.c @@ -761,6 +761,14 @@ static struct uv__io_uring_sqe* uv__iou_get_sqe(struct uv__iou* iou, * initialization failed. Anything else is a valid ring file descriptor. */ if (iou->ringfd == -2) { + /* By default, the SQPOLL is not created. Enable only if the loop is + * configured with UV_LOOP_USE_IO_URING_SQPOLL. + */ + if ((loop->flags & UV_LOOP_ENABLE_IO_URING_SQPOLL) == 0) { + iou->ringfd = -1; + return NULL; + } + uv__iou_init(loop->backend_fd, iou, 64, UV__IORING_SETUP_SQPOLL); if (iou->ringfd == -2) iou->ringfd = -1; /* "failed" */ diff --git a/src/unix/loop.c b/src/unix/loop.c index a9468e8e..179ee999 100644 --- a/src/unix/loop.c +++ b/src/unix/loop.c @@ -217,6 +217,14 @@ int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap) { return 0; } +#if defined(__linux__) + if (option == UV_LOOP_USE_IO_URING_SQPOLL) { + loop->flags |= UV_LOOP_ENABLE_IO_URING_SQPOLL; + return 0; + } +#endif + + if (option != UV_LOOP_BLOCK_SIGNAL) return UV_ENOSYS; |