diff mbox

[PATCHv2,1/1] IB/rxe: optimize the function duplicate_request

Message ID 1523335635-10611-1-git-send-email-yanjun.zhu@oracle.com (mailing list archive)
State Accepted
Headers show

Commit Message

Zhu Yanjun April 10, 2018, 4:47 a.m. UTC
In the function duplicate_request, the reference of skb can be increased
to replace the function skb_clone.

This will make rxe performace better and save memory.

CC: Srinivas Eeda <srinivas.eeda@oracle.com>
CC: Junxiao Bi <junxiao.bi@oracle.com>
Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
---
V1->V2: Follow Bart's suggestion, refcount_inc is replaced by skb_get.
---
 drivers/infiniband/sw/rxe/rxe_resp.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

Comments

Zhu Yanjun April 10, 2018, 4:47 a.m. UTC | #1
Hi,  Bart

A new patch is ready. Please check it.

Thanks a lot.

Zhu Yanjun


On 2018/4/10 12:47, Zhu Yanjun wrote:
> In the function duplicate_request, the reference of skb can be increased
> to replace the function skb_clone.
>
> This will make rxe performace better and save memory.
>
> CC: Srinivas Eeda <srinivas.eeda@oracle.com>
> CC: Junxiao Bi <junxiao.bi@oracle.com>
> Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
> ---
> V1->V2: Follow Bart's suggestion, refcount_inc is replaced by skb_get.
> ---
>   drivers/infiniband/sw/rxe/rxe_resp.c | 17 +++--------------
>   1 file changed, 3 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
> index a65c996..c4172ed 100644
> --- a/drivers/infiniband/sw/rxe/rxe_resp.c
> +++ b/drivers/infiniband/sw/rxe/rxe_resp.c
> @@ -1124,24 +1124,13 @@ static enum resp_states duplicate_request(struct rxe_qp *qp,
>   		/* Find the operation in our list of responder resources. */
>   		res = find_resource(qp, pkt->psn);
>   		if (res) {
> -			struct sk_buff *skb_copy;
> -
> -			skb_copy = skb_clone(res->atomic.skb, GFP_ATOMIC);
> -			if (skb_copy) {
> -				rxe_add_ref(qp); /* for the new SKB */
> -			} else {
> -				pr_warn("Couldn't clone atomic resp\n");
> -				rc = RESPST_CLEANUP;
> -				goto out;
> -			}
> -
> +			skb_get(res->atomic.skb);
>   			/* Resend the result. */
>   			rc = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp,
> -					     pkt, skb_copy);
> +					     pkt, res->atomic.skb);
>   			if (rc) {
>   				pr_err("Failed resending result. This flow is not handled - skb ignored\n");
> -				rxe_drop_ref(qp);
> -				kfree_skb(skb_copy);
> +				kfree_skb(res->atomic.skb);
>   				rc = RESPST_CLEANUP;
>   				goto out;
>   			}

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bart Van Assche April 10, 2018, 1:12 p.m. UTC | #2
On Tue, 2018-04-10 at 12:47 +0800, Yanjun Zhu wrote:
> A new patch is ready. Please check it.


Hello Zhu,

I will have a look as soon as I have time. But please keep in mind that we
are in the middle of the merge window and that that is the worst possible
time for posting patches. A quote from "On submitting patches": "And during
the merge window reviewer capacity tends to be in short order and there
might be none left for you."
(https://pdfs.semanticscholar.org/aaf6/72a30c68ac457bcbaf963d89f6c42ab50f82.pdf)

Bart.
Bart Van Assche April 10, 2018, 11:31 p.m. UTC | #3
On Tue, 2018-04-10 at 00:47 -0400, Zhu Yanjun wrote:
> In the function duplicate_request, the reference of skb can be increased

> to replace the function skb_clone.

> 

> This will make rxe performace better and save memory.


Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
Doug Ledford April 19, 2018, 5:59 p.m. UTC | #4
On Tue, 2018-04-10 at 23:31 +0000, Bart Van Assche wrote:
> On Tue, 2018-04-10 at 00:47 -0400, Zhu Yanjun wrote:
> > In the function duplicate_request, the reference of skb can be increased
> > to replace the function skb_clone.
> > 
> > This will make rxe performace better and save memory.
> 
> Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
> 
> 
> 

Thanks, applied to for-next.
diff mbox

Patch

diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
index a65c996..c4172ed 100644
--- a/drivers/infiniband/sw/rxe/rxe_resp.c
+++ b/drivers/infiniband/sw/rxe/rxe_resp.c
@@ -1124,24 +1124,13 @@  static enum resp_states duplicate_request(struct rxe_qp *qp,
 		/* Find the operation in our list of responder resources. */
 		res = find_resource(qp, pkt->psn);
 		if (res) {
-			struct sk_buff *skb_copy;
-
-			skb_copy = skb_clone(res->atomic.skb, GFP_ATOMIC);
-			if (skb_copy) {
-				rxe_add_ref(qp); /* for the new SKB */
-			} else {
-				pr_warn("Couldn't clone atomic resp\n");
-				rc = RESPST_CLEANUP;
-				goto out;
-			}
-
+			skb_get(res->atomic.skb);
 			/* Resend the result. */
 			rc = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp,
-					     pkt, skb_copy);
+					     pkt, res->atomic.skb);
 			if (rc) {
 				pr_err("Failed resending result. This flow is not handled - skb ignored\n");
-				rxe_drop_ref(qp);
-				kfree_skb(skb_copy);
+				kfree_skb(res->atomic.skb);
 				rc = RESPST_CLEANUP;
 				goto out;
 			}