All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan aloni <alonid-IGuEOkGjbyfby3iVrkZq2A@public.gmane.org>
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Eli Cohen <eli-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>,
	Julian Satran <julians-IGuEOkGjbyfby3iVrkZq2A@public.gmane.org>
Subject: [PATCH] ib: mlx4 map fix for large hugetlb areas
Date: Mon, 6 Jun 2011 14:29:53 +0300	[thread overview]
Message-ID: <20110606112953.GA20154@alonid-pc> (raw)

When an application tries to map a large area of hugetlb pages, the
mlx4 code rightfully reachs handle_hugetlb_user_mr(). This function
uses an intermediate allocation in order to pass the list of big pages
to mlx4_write_mtt(), however that this allocation, when passing over
for example, 128GB of hugetlb memory (63365 pages), maps to 65536*8
bytes of memory, which is not supported by kmalloc() under various
kernel configurations.

It would be prudent to use vmalloc() here.

NOTE: core_umem will still hold 1GB of descriptors for mapping 128GB
of memory, even though it's hugetlb. This needs to be optimized as
well.

Signed-off-by: Dan Aloni <alonid-IGuEOkGjbyfby3iVrkZq2A@public.gmane.org>
---
 drivers/infiniband/hw/mlx4/mr.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/mr.c b/drivers/infiniband/hw/mlx4/mr.c
index e6c096c..59f2909 100644
--- a/drivers/infiniband/hw/mlx4/mr.c
+++ b/drivers/infiniband/hw/mlx4/mr.c
@@ -140,7 +140,7 @@ static int handle_hugetlb_user_mr(struct ib_pd *pd, struct mlx4_ib_mr *mr,
 	int off = start & (HPAGE_SIZE - 1);
 
 	n = DIV_ROUND_UP(off + umem->length, HPAGE_SIZE);
-	arr = kmalloc(n * sizeof *arr, GFP_KERNEL);
+	arr = vmalloc(n * sizeof *arr);
 	if (!arr)
 		return -ENOMEM;
 
@@ -178,7 +178,7 @@ static int handle_hugetlb_user_mr(struct ib_pd *pd, struct mlx4_ib_mr *mr,
 	err = mlx4_write_mtt(dev->dev, &mr->mmr.mtt, 0, n, arr);
 
 out:
-	kfree(arr);
+	vfree(arr);
 	return err;
 #else
 	return -ENOSYS;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2011-06-06 11:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-06 11:29 Dan aloni [this message]
2011-06-06 16:09 ` [PATCH] ib: mlx4 map fix for large hugetlb areas Roland Dreier
     [not found]   ` <BANLkTikatAo9FYO=iuNzCk2X9x_mAr3mZg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-06 19:27     ` Eli Cohen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110606112953.GA20154@alonid-pc \
    --to=alonid-igueokgjbyfby3ivrkzq2a@public.gmane.org \
    --cc=eli-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org \
    --cc=julians-IGuEOkGjbyfby3iVrkZq2A@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.