--- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -4343,6 +4343,7 @@ static int __io_remove_buffers(struct io kfree(nxt); if (++i == nbufs) return i; + cond_resched(); } i++; kfree(buf); @@ -9249,10 +9250,8 @@ static void io_destroy_buffers(struct io struct io_buffer *buf; unsigned long index; - xa_for_each(&ctx->io_buffers, index, buf) { + xa_for_each(&ctx->io_buffers, index, buf) __io_remove_buffers(ctx, buf, index, -1U); - cond_resched(); - } } static void io_req_cache_free(struct list_head *list)