[PATCH 3/3] io_uring: properly mark async work as bounded vs unbounded

Jens Axboe
2019-11-07T18:29:33Z

Now that io-wq supports separating the two request lifetime types, mark
the following IO as having unbounded runtimes:

- Any read/write to a non-regular file
- Any specific networked IO
- Any poll command

Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
fs/io_uring.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index c48b891b962f..f8344f95817e 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -505,6 +505,20 @@ static inline bool io_prep_async_work(struct io_kiocb *req)
case IORING_OP_WRITEV:
case IORING_OP_WRITE_FIXED:
do_hashed = true;
+ /* fall-through */
+ case IORING_OP_READV:
+ case IORING_OP_READ_FIXED:
+ case IORING_OP_SENDMSG:
+ case IORING_OP_RECVMSG:
+ case IORING_OP_ACCEPT:
+ case IORING_OP_POLL_ADD:
+ /*
+ * We know REQ_F_ISREG is not set on some of these
+ * opcodes, but this enables us to keep the check in
+ * just one place.
+ */
+ if (!(req->flags & REQ_F_ISREG))
+ req->work.flags |= IO_WQ_WORK_UNBOUND;
break;
}
if (io_sqe_needs_user(req->submit.sqe))
--
2.24.0