Re: [PATCH 4/4] io_uring: mark opcodes that always need io-wq punt

Ming Lei
2023-04-24T07:31:56Z

On Thu, Apr 20, 2023 at 12:31:35PM -0600, Jens Axboe wrote:
> Add an opdef bit for them, and set it for the opcodes where we always
> need io-wq punt. With that done, exclude them from the file_can_poll()
> check in terms of whether or not we need to punt them if any of the
> NO_OFFLOAD flags are set.
>
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
> ---
> io_uring/io_uring.c | 2 +-
> io_uring/opdef.c | 22 ++++++++++++++++++++--
> io_uring/opdef.h | 2 ++
> 3 files changed, 23 insertions(+), 3 deletions(-)
>
> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
> index fee3e461e149..420cfd35ebc6 100644
> --- a/io_uring/io_uring.c
> +++ b/io_uring/io_uring.c
> @@ -1948,7 +1948,7 @@ static int io_issue_sqe(struct io_kiocb *req, unsigned int issue_flags)
> return -EBADF;
>
> if (issue_flags & IO_URING_F_NO_OFFLOAD &&
> - (!req->file || !file_can_poll(req->file)))
> + (!req->file || !file_can_poll(req->file) || def->always_iowq))
> issue_flags &= ~IO_URING_F_NONBLOCK;

I guess the check should be !def->always_iowq?

Thanks,
Ming