From: Leon Romanovsky <leon@kernel.org>
To: Jan Dakinevich <jan.dakinevich@virtuozzo.com>
Cc: Doug Ledford <dledford@redhat.com>,
Jason Gunthorpe <jgg@ziepe.ca>,
Bart Van Assche <bart.vanassche@wdc.com>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
Denis Lunev <den@virtuozzo.com>,
Konstantin Khorenko <khorenko@virtuozzo.com>
Subject: Re: [PATCH] ib_srpt: use kvmalloc to allocate ring pointers
Date: Tue, 10 Jul 2018 08:39:44 +0300 [thread overview]
Message-ID: <20180710053944.GN3014@mtr-leonro.mtl.com> (raw)
In-Reply-To: <1531144268-25361-1-git-send-email-jan.dakinevich@virtuozzo.com>
[-- Attachment #1: Type: text/plain, Size: 1968 bytes --]
On Mon, Jul 09, 2018 at 04:51:08PM +0300, Jan Dakinevich wrote:
> An array of pointers to SRPT contexts in ib_device is over 30KiB even
> in default case, in which an amount of contexts is 4095. The patch
> is intended to weed out large contigous allocation for non-DMA memory.
kvmalloc* doesn't "weed out" large contiguous allocations, but tries to
allocate them and gracefully fallback to vmalloc if kmalloc fails.
More on that, for allocations less than page (64KB for PowerPC), it will
not call to vmalloc at all, which is fine too, because pages granularity.
If you want to get rid of "contiguous allocations", use vmalloc instead.
Thanks
>
> Signed-off-by: Jan Dakinevich <jan.dakinevich@virtuozzo.com>
> ---
> drivers/infiniband/ulp/srpt/ib_srpt.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
> index 3081c62..de167af 100644
> --- a/drivers/infiniband/ulp/srpt/ib_srpt.c
> +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
> @@ -720,7 +720,7 @@ static struct srpt_ioctx **srpt_alloc_ioctx_ring(struct srpt_device *sdev,
> WARN_ON(ioctx_size != sizeof(struct srpt_recv_ioctx)
> && ioctx_size != sizeof(struct srpt_send_ioctx));
>
> - ring = kmalloc_array(ring_size, sizeof(ring[0]), GFP_KERNEL);
> + ring = kvmalloc_array(ring_size, sizeof(ring[0]), GFP_KERNEL);
> if (!ring)
> goto out;
> for (i = 0; i < ring_size; ++i) {
> @@ -734,7 +734,7 @@ static struct srpt_ioctx **srpt_alloc_ioctx_ring(struct srpt_device *sdev,
> err:
> while (--i >= 0)
> srpt_free_ioctx(sdev, ring[i], dma_size, dir);
> - kfree(ring);
> + kvfree(ring);
> ring = NULL;
> out:
> return ring;
> @@ -759,7 +759,7 @@ static void srpt_free_ioctx_ring(struct srpt_ioctx **ioctx_ring,
>
> for (i = 0; i < ring_size; ++i)
> srpt_free_ioctx(sdev, ioctx_ring[i], dma_size, dir);
> - kfree(ioctx_ring);
> + kvfree(ioctx_ring);
> }
>
> /**
> --
> 2.1.4
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
next prev parent reply other threads:[~2018-07-10 5:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-09 13:51 [PATCH] ib_srpt: use kvmalloc to allocate ring pointers Jan Dakinevich
2018-07-09 20:56 ` Bart Van Assche
2018-07-09 22:16 ` Jason Gunthorpe
2018-07-10 5:39 ` Leon Romanovsky [this message]
2018-07-10 15:08 ` Bart Van Assche
2018-07-10 15:53 ` Leon Romanovsky
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=20180710053944.GN3014@mtr-leonro.mtl.com \
--to=leon@kernel.org \
--cc=bart.vanassche@wdc.com \
--cc=den@virtuozzo.com \
--cc=dledford@redhat.com \
--cc=jan.dakinevich@virtuozzo.com \
--cc=jgg@ziepe.ca \
--cc=khorenko@virtuozzo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox