public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: bfields@fieldses.org (J. Bruce Fields)
To: Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org
Subject: Re: [PATCH v1 4/6] svcrdma: Add a batch Receive posting mechanism
Date: Mon, 22 Mar 2021 13:16:14 -0400	[thread overview]
Message-ID: <20210322171614.GB24580@fieldses.org> (raw)
In-Reply-To: <161616429593.173092.14052996014785354959.stgit@klimt.1015granger.net>

On Fri, Mar 19, 2021 at 10:31:35AM -0400, Chuck Lever wrote:
> Introduce a server-side mechanism similar to commit e340c2d6ef2a
> ("xprtrdma: Reduce the doorbell rate (Receive)") to post Receive
> WRs in batch. It's first consumer is svc_rdma_post_recvs().

s/It's/Its'/.

Patches look OK to me.--b.

> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>  net/sunrpc/xprtrdma/svc_rdma_recvfrom.c |   56 +++++++++++++++++++++++--------
>  1 file changed, 42 insertions(+), 14 deletions(-)
> 
> diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
> index 04148a656b2a..0c6aa8693f20 100644
> --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
> +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
> @@ -264,6 +264,47 @@ void svc_rdma_release_rqst(struct svc_rqst *rqstp)
>  		svc_rdma_recv_ctxt_put(rdma, ctxt);
>  }
>  
> +static bool svc_rdma_refresh_recvs(struct svcxprt_rdma *rdma,
> +				   unsigned int wanted, bool temp)
> +{
> +	const struct ib_recv_wr *bad_wr = NULL;
> +	struct svc_rdma_recv_ctxt *ctxt;
> +	struct ib_recv_wr *recv_chain;
> +	int ret;
> +
> +	if (test_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags))
> +		return false;
> +
> +	recv_chain = NULL;
> +	while (wanted--) {
> +		ctxt = svc_rdma_recv_ctxt_get(rdma);
> +		if (!ctxt)
> +			break;
> +
> +		trace_svcrdma_post_recv(ctxt);
> +		ctxt->rc_temp = temp;
> +		ctxt->rc_recv_wr.next = recv_chain;
> +		recv_chain = &ctxt->rc_recv_wr;
> +	}
> +	if (!recv_chain)
> +		return false;
> +
> +	ret = ib_post_recv(rdma->sc_qp, recv_chain, &bad_wr);
> +	if (ret)
> +		goto err_free;
> +	return true;
> +
> +err_free:
> +	trace_svcrdma_rq_post_err(rdma, ret);
> +	while (bad_wr) {
> +		ctxt = container_of(bad_wr, struct svc_rdma_recv_ctxt,
> +				    rc_recv_wr);
> +		bad_wr = bad_wr->next;
> +		svc_rdma_recv_ctxt_put(rdma, ctxt);
> +	}
> +	return false;
> +}
> +
>  static int __svc_rdma_post_recv(struct svcxprt_rdma *rdma,
>  				struct svc_rdma_recv_ctxt *ctxt)
>  {
> @@ -301,20 +342,7 @@ static int svc_rdma_post_recv(struct svcxprt_rdma *rdma)
>   */
>  bool svc_rdma_post_recvs(struct svcxprt_rdma *rdma)
>  {
> -	struct svc_rdma_recv_ctxt *ctxt;
> -	unsigned int i;
> -	int ret;
> -
> -	for (i = 0; i < rdma->sc_max_requests; i++) {
> -		ctxt = svc_rdma_recv_ctxt_get(rdma);
> -		if (!ctxt)
> -			return false;
> -		ctxt->rc_temp = true;
> -		ret = __svc_rdma_post_recv(rdma, ctxt);
> -		if (ret)
> -			return false;
> -	}
> -	return true;
> +	return svc_rdma_refresh_recvs(rdma, rdma->sc_max_requests, true);
>  }
>  
>  /**
> 

  reply	other threads:[~2021-03-22 17:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-19 14:31 [PATCH v1 0/6] svcrdma Receive batch-posting, take 2 Chuck Lever
2021-03-19 14:31 ` [PATCH v1 1/6] svcrdma: RPCDBG_FACILITY is no longer used Chuck Lever
2021-03-19 14:31 ` [PATCH v1 2/6] svcrdma: Provide an explanatory comment in CMA event handler Chuck Lever
2021-03-19 14:31 ` [PATCH v1 3/6] svcrdma: Remove stale comment for svc_rdma_wc_receive() Chuck Lever
2021-03-19 14:31 ` [PATCH v1 4/6] svcrdma: Add a batch Receive posting mechanism Chuck Lever
2021-03-22 17:16   ` J. Bruce Fields [this message]
2021-03-22 17:17     ` Chuck Lever III
2021-03-22 17:31       ` Daniel Forrest
2021-03-19 14:31 ` [PATCH v1 5/6] svcrdma: Use svc_rdma_refresh_recvs() in wc_receive Chuck Lever
2021-03-19 14:31 ` [PATCH v1 6/6] svcrdma: Maintain a Receive water mark Chuck Lever

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 \
    --in-reply-to=20210322171614.GB24580@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /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