]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: punt final io_ring_ctx wait-and-free to workqueue
authorJens Axboe <axboe@kernel.dk>
Fri, 10 Apr 2020 00:14:00 +0000 (18:14 -0600)
committerJens Axboe <axboe@kernel.dk>
Fri, 10 Apr 2020 00:45:27 +0000 (18:45 -0600)
commitdbbd3cc36bec13b38c411aa0e9e65dd64130209b
tree5889b4560c5d4c6be271181d7d48dd350e88dd4a
parent8cf86ec443b55905545c2cd6b9341b2a8072a931
io_uring: punt final io_ring_ctx wait-and-free to workqueue

We can't reliably wait in io_ring_ctx_wait_and_kill(), since the
task_works list isn't ordered (in fact it's LIFO ordered). We could
either fix this with a separate task_works list for io_uring work, or
just punt the wait-and-free to async context. This ensures that
task_work that comes in while we're shutting down is processed
correctly. If we don't go async, we could have work past the fput()
work for the ring that depends on work that won't be executed until
after we're done with the wait-and-free. But as this operation is
blocking, it'll never get a chance to run.

This was reproduced with hundreds of thousands of sockets running
memcached, haven't been able to reproduce this synthetically.

Reported-by: Dan Melnic <dmm@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c