[openib-general] ib_create_cq memory leak?
Viswanath Krishnamurthy
viswa.krish at gmail.com
Thu Sep 22 11:32:39 PDT 2005
Roland,
Thanks. Tested this out.. Works like a charm...
-Viswa
On 9/21/05, Roland Dreier <rolandd at cisco.com> wrote:
>
> Thanks very much for the excellent test case. The following patch
> (already checked into svn and queued in git for merging into 2.6.14)
> should fix things -- on my system, your test case ran successfully for
> many hundreds of iterations.
>
> --- linux-kernel/infiniband/hw/mthca/mthca_memfree.c (revision 3500)
> +++ linux-kernel/infiniband/hw/mthca/mthca_memfree.c (working copy)
> @@ -529,12 +529,25 @@ int mthca_alloc_db(struct mthca_dev *dev
> goto found;
> }
>
> + for (i = start; i != end; i += dir)
> + if (!dev->db_tab->page[i].db_rec) {
> + page = dev->db_tab->page + i;
> + goto alloc;
> + }
> +
> if (dev->db_tab->max_group1 >= dev->db_tab->min_group2 - 1) {
> ret = -ENOMEM;
> goto out;
> }
>
> + if (group == 0)
> + ++dev->db_tab->max_group1;
> + else
> + --dev->db_tab->min_group2;
> +
> page = dev->db_tab->page + end;
> +
> +alloc:
> page->db_rec = dma_alloc_coherent(&dev->pdev->dev, 4096,
> &page->mapping, GFP_KERNEL);
> if (!page->db_rec) {
> @@ -554,10 +567,6 @@ int mthca_alloc_db(struct mthca_dev *dev
> }
>
> bitmap_zero(page->used, MTHCA_DB_REC_PER_PAGE);
> - if (group == 0)
> - ++dev->db_tab->max_group1;
> - else
> - --dev->db_tab->min_group2;
>
> found:
> j = find_first_zero_bit(page->used, MTHCA_DB_REC_PER_PAGE);
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20050922/7acdeb31/attachment.html>
More information about the general
mailing list