[ofa-general] Re: [PATCH 5/5] IB/ipoib: IPOIB rx post list

Shirley Ma mashirle at us.ibm.com
Mon Feb 4 09:35:28 PST 2008


Hello Eli,

I have seen heavily memory leak (system run out of memory) and very bad
performance when errors after your patch checked in. I am back looking
at the code. Below place has memory leak. When ib_post_recv() has
problem, only one skb gets freed. And this kind of post_recv() could
hurt the performance significantly if one fails. Please correct me if I
understand incorrectly.

Thanks
Shirley


+static int ipoib_ib_post_receive(struct net_device *dev, int id)
+{
+       struct ipoib_dev_priv *priv = netdev_priv(dev);
+       struct ib_recv_wr *bad_wr;
+       int ret = 0;
+       int i = priv->rx_outst;
+
+       priv->sglist_draft[i].addr = priv->rx_ring[id].mapping;
+       priv->rx_wr_draft[i].wr_id = id | IPOIB_OP_RECV;
+       if (++priv->rx_outst == UD_POST_RCV_COUNT) {
+               ret = ib_post_recv(priv->qp, priv->rx_wr_draft,
&bad_wr);
+
+               if (unlikely(ret)) {
+                       ipoib_warn(priv, "receive failed for buf %d (%
d)\n", id, ret);
+                       while (bad_wr) {
+                               id = bad_wr->wr_id & ~IPOIB_OP_RECV;
+                               ib_dma_unmap_single(priv->ca,
priv->rx_ring[id].mapping,
+                                                   IPOIB_BUF_SIZE,
DMA_FROM_DEVICE);
+                               dev_kfree_skb_any(priv->rx_ring[id].skb);
+                               priv->rx_ring[id].skb = NULL;
+                       }
+               }
+               priv->rx_outst = 0;
+       }

        return ret;
 }




More information about the general mailing list