History

IB/rxe: optimize mcast recv process

In mcast recv process, the function skb_clone is used. In fact, the refcount can be increased to replace cloning a new skb since the original skb will not be modified before it is freed. This can make the performance better and save the memory.

Zhu Yanjun committed 8 years ago

Commit 99dae691 parent a343e3f1 file · +4 −10Browse files

Unified · Split

drivers/infiniband/sw/rxe/rxe_recv.c+4−10
@@ -276,7 +276,6 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb) · 275 unmodified lines
276276 {
277277 struct rxe_pkt_info *pkt = SKB_TO_PKT(skb);
278278 struct rxe_mc_grp *mcg;
279− struct sk_buff *skb_copy;
280279 struct rxe_mc_elem *mce;
281280 struct rxe_qp *qp;
282281 union ib_gid dgid;
@@ -309,18 +308,14 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb) · 26 unmodified lines
309308 continue;
310309
311310 /* if *not* the last qp in the list
312− * make a copy of the skb to post to the next qp
311+ * increase the users of the skb then post to the next qp
313312 */
314− skb_copy = (mce->qp_list.next != &mcg->qp_list) ?
315− skb_clone(skb, GFP_ATOMIC) : NULL;
313+ if (mce->qp_list.next != &mcg->qp_list)
314+ refcount_inc(&skb->users);
316315
317316 pkt->qp = qp;
318317 rxe_add_ref(qp);
319318 rxe_rcv_pkt(rxe, pkt, skb);
320−
321− skb = skb_copy;
322− if (!skb)
323− break;
324319 }
325320
326321 spin_unlock_bh(&mcg->mcg_lock);
@@ -328,8 +323,7 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb) · 1 unmodified line
328323 rxe_drop_ref(mcg); /* drop ref from rxe_pool_get_key. */
329324
330325 err1:
331− if (skb)
332− kfree_skb(skb);
326+ kfree_skb(skb);
333327 }
334328
335329 static int rxe_match_dgid(struct rxe_dev *rxe, struct sk_buff *skb)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t