Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring: allow conditional reschedule for intensive iterators

If we have a lot of threads and rings, the tctx list can get quite big.
This is especially true if we keep creating new threads and rings.
Likewise for the provided buffers list. Be nice and insert a conditional
reschedule point while iterating the nodes for deletion.

Link: https://lore.kernel.org/io-uring/00000000000064b6b405ccb41113@google.com/
Reported-by: syzbot+111d2a03f51f5ae73775@syzkaller.appspotmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>

+6 -2
+6 -2
fs/io_uring.c
··· 9173 9173 struct io_buffer *buf; 9174 9174 unsigned long index; 9175 9175 9176 - xa_for_each(&ctx->io_buffers, index, buf) 9176 + xa_for_each(&ctx->io_buffers, index, buf) { 9177 9177 __io_remove_buffers(ctx, buf, index, -1U); 9178 + cond_resched(); 9179 + } 9178 9180 } 9179 9181 9180 9182 static void io_req_cache_free(struct list_head *list) ··· 9674 9672 struct io_tctx_node *node; 9675 9673 unsigned long index; 9676 9674 9677 - xa_for_each(&tctx->xa, index, node) 9675 + xa_for_each(&tctx->xa, index, node) { 9678 9676 io_uring_del_tctx_node(index); 9677 + cond_resched(); 9678 + } 9679 9679 if (wq) { 9680 9680 /* 9681 9681 * Must be after io_uring_del_task_file() (removes nodes under