public inbox for [email protected]
 help / color / mirror / Atom feed
From: Jens Axboe <[email protected]>
To: Hao Xu <[email protected]>, [email protected]
Cc: Pavel Begunkov <[email protected]>, [email protected]
Subject: Re: [PATCH 4/4] io_uring: implement multishot mode for accept
Date: Sat, 7 May 2022 09:23:59 -0600	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 5/7/22 9:20 AM, Hao Xu wrote:
> @@ -5757,8 +5771,26 @@ static int io_accept(struct io_kiocb *req, unsigned int issue_flags)
>  		ret = io_install_fixed_file(req, file, issue_flags,
>  					    accept->file_slot - 1);
>  	}
> -	__io_req_complete(req, issue_flags, ret, 0);
> -	return 0;
> +
> +	if (!(req->flags & REQ_F_APOLL_MULTISHOT)) {
> +		__io_req_complete(req, issue_flags, ret, 0);
> +		return 0;
> +	}
> +	if (ret >= 0) {
> +		bool filled;
> +
> +		spin_lock(&ctx->completion_lock);
> +		filled = io_fill_cqe_aux(ctx, req->cqe.user_data, ret,
> +					 IORING_CQE_F_MORE);
> +		io_commit_cqring(ctx);
> +		spin_unlock(&ctx->completion_lock);
> +		if (!filled)
> +			return -ECANCELED;
> +		io_cqring_ev_posted(ctx);
> +		goto retry;
> +	}
> +
> +	return ret;

I'd still make that:

	if (filled) {
		io_cqring_ev_posted(ctx);
		goto retry;
	}
	ret = -ECANCELED;

as it flows better and shows what the likely outcome is.

>  static int io_connect_prep_async(struct io_kiocb *req)
> diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h
> index f4d9ca62a5a6..7c3d70d12428 100644
> --- a/include/uapi/linux/io_uring.h
> +++ b/include/uapi/linux/io_uring.h
> @@ -224,9 +224,9 @@ enum {
>  #define IORING_RECVSEND_POLL_FIRST	(1U << 0)
>  
>  /*
> - * accept flags stored in accept_flags
> + * accept flags stored in sqe->ioprio
>   */
> -#define IORING_ACCEPT_MULTISHOT	(1U << 15)
> +#define IORING_ACCEPT_MULTISHOT	(1U << 0)
>  
>  /*
>   * IO completion data structure (Completion Queue Entry)

This hunk needs to get folded in to the patch that adds the flag in the
first place.

-- 
Jens Axboe


  reply	other threads:[~2022-05-07 15:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-07 15:20 [PATCH 4/4] io_uring: implement multishot mode for accept Hao Xu
2022-05-07 15:23 ` Jens Axboe [this message]
     [not found] <[email protected]>
2022-05-07 17:15 ` Hao Xu
     [not found] <[email protected]>
2022-05-08 15:32 ` Hao Xu
2022-05-10  3:20   ` Jens Axboe
     [not found] <[email protected]>
2022-05-08 15:37 ` Hao Xu
  -- strict thread matches above, loose matches on Subject: below --
2022-05-14 14:20 [PATCH v6 0/4] fast poll multishot mode Hao Xu
2022-05-14 14:20 ` [PATCH 4/4] io_uring: implement multishot mode for accept Hao Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox