Cancel and wait for all requests on exit
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest5 patches 8 repliesIn review
- v2 RFC5 patches 4 repliesSuperseded
- v1 RFC5 patches 7 repliesSuperseded
Changes in v3 from the cover letter
- Fix logic error io_queue_iowq()
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | fs: gate final fput task_work on PF_NO_TASKWORKfs/ include/ kernel/ | +3 | 6 replies | |
| 2/5 | io_uring: mark exit side kworkers as task_work capableio_uring/ | +21 | 2 replies | |
| 3/5 | io_uring: consider ring dead once the ref is marked dyingio_uring/ | +4 | 0 replies | |
| 4/5 | io_uring: wait for cancelations on final ring putinclude/ io_uring/ | +19 | 0 replies | |
| 5/5 | io_uring: switch away from percpu refcountsinclude/ io_uring/ io_uring/ +6 more | +70 | 0 replies |
Reviews trailers per patch
1 of 5 patches has a Reviewed-by or Acked-by.
| Patch | Christian Brauner |
|---|---|
| 1/5 | A-b |
| 2/5 | |
| 3/5 | |
| 4/5 | |
| 5/5 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCHSET v3 0/5] Cancel and wait for all requests on exit
Hi,
Currently, when a ring is being shut down, some cancelations may happen out-of-line. This means that an application cannot rely on the ring exit meaning that any IO has fully completed, or someone else waiting on an application (which has a ring with pending IO) being terminated will mean that all requests are done. This has also manifested itself as various testing sometimes finding a mount point busy after a test has exited, because it may take a brief period of time for things to quiesce and be fully done.
This patchset makes the task wait on the cancelations, if any, when the io_uring file fd is being put. That has the effect of ensuring that pending IO has fully completed, and files closed, before the ring exit returns.
io_uring runs cancelations off kthread based fallback work, and patch 1 enables these to run task_work so we'll know that we can put files inline and not need rely on deadlock prune flushing of the delayed fput work item. The rest of the patches are all io_uring based and pretty straight forward. This fundamentally doesn't change how cancelations work, it just waits on the out-of-line cancelations and request queiscing before exiting.
The switch away from percpu reference counts is done mostly because exiting those references will cost us an RCU grace period. That will noticeably slow down the ring tear down by anywhere from 10-100x.
The changes can also be found here:
https://git.kernel.dk/cgit/linux/log/?h=io_uring-exit-cancel.2
Since v2:
- Fix logic error io_queue_iowq()
fs/file_table.c | 2 +- include/linux/io_uring_types.h | 4 +- include/linux/sched.h | 2 +- io_uring/io_uring.c | 79 +++++++++++++++++++++++----------- io_uring/io_uring.h | 3 +- io_uring/msg_ring.c | 4 +- io_uring/refs.h | 43 ++++++++++++++++++ io_uring/register.c | 2 +- io_uring/rw.c | 2 +- io_uring/sqpoll.c | 2 +- io_uring/zcrx.c | 4 +- kernel/fork.c | 2 +- 12 files changed, 111 insertions(+), 38 deletions(-)
Signature · 1 line
Jens Axboe