[openib-general] [mthca] Creation of a SRQ with many WR (> 16K) in kernel level fails

Dotan Barak dotanb at dev.mellanox.co.il
Tue Jan 30 00:44:37 PST 2007


Hi Roland.

I opened bug 331 in the bugzilla with the following content:


When one tries to create a SRQ with many WR (> 16K WR), creation of the SRQ
fails.

The problem appears to be in the file: mthca_srq.c.

Here is the problematic code:

static int mthca_alloc_srq_buf(struct mthca_dev *dev, struct mthca_pd *pd,
                               struct mthca_srq *srq)
{
        struct mthca_data_seg *scatter;
        void *wqe;
        int err;
        int i;

        if (pd->ibpd.uobject)
                return 0;

        srq->wrid = kmalloc(srq->max * sizeof (u64), GFP_KERNEL);
        if (!srq->wrid)
                return -ENOMEM;


which means that creating a SRQ with 16K WRs (or more), the driver will try to
allocate 16K*8=128K bytes using kmalloc. This is a very high amount of memory
to be allocated using kmalloc.


The fix can be replacing this kmalloc with a different type of memory allocation.


Thanks
Dotan





More information about the general mailing list