Skip to content

Commit 5793b46

Browse files
Zhu Yanjundledford
authored andcommitted
IB/rxe: remove unnecessary skb_clone in xmit
In xmit, there is a skb_clone. This function copies the struct sk_buff. And some parameters are changed to the new skb. Then the new skb is sent while the old skb is freed. While the function skb_clone is removed, the parameter changes are made on the old skb, then the old skb is sent. It can also work well. The following tests are made. server client --------- --------- |1.1.1.1|<----rxe-channel--->|1.1.1.2| --------- --------- On server: rping -s -a 1.1.1.1 -v -C 1000 -S 512 On client: rping -c -a 1.1.1.1 -v -C 1000 -S 512 The kernel config CONFIG_DEBUG_KMEMLEAK is enabled on both server and client. This test runs for several hours. There is no memory leak and the whole system can work well. As the above network, the following tests are made. Server: ibv_rc_pingpong -d rxe0 -g 1 Client: ibv_rc_pingpong -d rxe0 -g 1 1.1.1.1 The result on Server. Before: 8192000 bytes in 0.88 seconds = 74.36 Mbit/sec 1000 iters in 0.88 seconds = 881.30 usec/iter After: 8192000 bytes in 0.81 seconds = 81.15 Mbit/sec 1000 iters in 0.81 seconds = 807.62 usec/iter The throughput is enhanced and the latency is reduced. CC: Srinivas Eeda <srinivas.eeda@oracle.com> CC: Joe Jin <joe.jin@oracle.com> CC: Junxiao Bi <junxiao.bi@oracle.com> Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
1 parent 91eab79 commit 5793b46

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

‎drivers/infiniband/sw/rxe/rxe_net.c‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -452,31 +452,26 @@ static void rxe_skb_tx_dtor(struct sk_buff *skb)
452452

453453
int rxe_send(struct rxe_dev *rxe, struct rxe_pkt_info *pkt, struct sk_buff *skb)
454454
{
455-
struct sk_buff *nskb;
456455
struct rxe_av *av;
457456
int err;
458457

459458
av = rxe_get_av(pkt);
460459

461-
nskb = skb_clone(skb, GFP_ATOMIC);
462-
if (!nskb)
463-
return -ENOMEM;
464-
465-
nskb->destructor = rxe_skb_tx_dtor;
466-
nskb->sk = pkt->qp->sk->sk;
460+
skb->destructor = rxe_skb_tx_dtor;
461+
skb->sk = pkt->qp->sk->sk;
467462

468463
rxe_add_ref(pkt->qp);
469464
atomic_inc(&pkt->qp->skb_out);
470465

471466
if (av->network_type == RDMA_NETWORK_IPV4) {
472-
err = ip_local_out(dev_net(skb_dst(skb)->dev), nskb->sk, nskb);
467+
err = ip_local_out(dev_net(skb_dst(skb)->dev), skb->sk, skb);
473468
} else if (av->network_type == RDMA_NETWORK_IPV6) {
474-
err = ip6_local_out(dev_net(skb_dst(skb)->dev), nskb->sk, nskb);
469+
err = ip6_local_out(dev_net(skb_dst(skb)->dev), skb->sk, skb);
475470
} else {
476471
pr_err("Unknown layer 3 protocol: %d\n", av->network_type);
477472
atomic_dec(&pkt->qp->skb_out);
478473
rxe_drop_ref(pkt->qp);
479-
kfree_skb(nskb);
474+
kfree_skb(skb);
480475
return -EINVAL;
481476
}
482477

@@ -485,7 +480,6 @@ int rxe_send(struct rxe_dev *rxe, struct rxe_pkt_info *pkt, struct sk_buff *skb)
485480
return -EAGAIN;
486481
}
487482

488-
kfree_skb(skb);
489483
return 0;
490484
}
491485

0 commit comments

Comments
 (0)