Skip to content

Commit 73eaa2b

Browse files
committed
io_uring: use private workqueue for exit work
Rather than use the system unbound event workqueue, use an io_uring specific one. This avoids dependencies with the tty, which also uses the system_unbound_wq, and issues flushes of said workqueue from inside its poll handling. Cc: [email protected] Reported-by: Rasmus Karlsson <[email protected]> Tested-by: Rasmus Karlsson <[email protected]> Tested-by: Iskren Chernev <[email protected]> Link: axboe/liburing#1113 Signed-off-by: Jens Axboe <[email protected]>
1 parent bee1d5b commit 73eaa2b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

io_uring/io_uring.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ static bool io_uring_try_cancel_requests(struct io_ring_ctx *ctx,
147147
static void io_queue_sqe(struct io_kiocb *req);
148148

149149
struct kmem_cache *req_cachep;
150+
static struct workqueue_struct *iou_wq __ro_after_init;
150151

151152
static int __read_mostly sysctl_io_uring_disabled;
152153
static int __read_mostly sysctl_io_uring_group = -1;
@@ -3166,7 +3167,7 @@ static __cold void io_ring_ctx_wait_and_kill(struct io_ring_ctx *ctx)
31663167
* noise and overhead, there's no discernable change in runtime
31673168
* over using system_wq.
31683169
*/
3169-
queue_work(system_unbound_wq, &ctx->exit_work);
3170+
queue_work(iou_wq, &ctx->exit_work);
31703171
}
31713172

31723173
static int io_uring_release(struct inode *inode, struct file *file)
@@ -4190,6 +4191,8 @@ static int __init io_uring_init(void)
41904191
io_buf_cachep = KMEM_CACHE(io_buffer,
41914192
SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT);
41924193

4194+
iou_wq = alloc_workqueue("iou_exit", WQ_UNBOUND, 64);
4195+
41934196
#ifdef CONFIG_SYSCTL
41944197
register_sysctl_init("kernel", kernel_io_uring_disabled_table);
41954198
#endif

0 commit comments

Comments
 (0)