io_uring: skip overflow CQE posting for dying ring
authorPavel Begunkov <asml.silence@gmail.com>
Wed, 7 Dec 2022 03:53:28 +0000 (03:53 +0000)
committerJens Axboe <axboe@kernel.dk>
Wed, 7 Dec 2022 13:47:13 +0000 (06:47 -0700)
commita85381d8326d75417ae177bddf44be533d1d21be
tree55eb2286483f1e669e9ba13e016b640d25fd2f26
parent4c979eaefa4356d385b7c7d2877dc04d7fe88969
io_uring: skip overflow CQE posting for dying ring

After io_ring_ctx_wait_and_kill() is called there should be no users
poking into rings and so there is no need to post CQEs. So, instead of
trying to post overflowed CQEs into the CQ, drop them. Also, do it
in io_ring_exit_work() in a loop to reduce the number of contexts it
can be executed from and even when it struggles to quiesce the ring we
won't be leaving memory allocated for longer than needed.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/26d13751155a735a3029e24f8d9ca992f810419d.1670384893.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/io_uring.c