[Devel] [PATCH] ib_srpt: use vmalloc to allocate ring pointers

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jul 5 11:20:07 MSK 2018


Please send the patch to mainstream as well.

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team

On 07/04/2018 09:07 PM, Jan Dakinevich wrote:
> An arrays of pointers to SRPT contexts in ib_device is over 30KiB even in
> default case, in an amount of contexts is 4095. The patch is intended to
> weed out large contigous allocation for non-DMA memory.
>
> https://jira.sw.ru/browse/HCI-100
> Signed-off-by: Jan Dakinevich <jan.dakinevich at virtuozzo.com>
> ---
>  drivers/infiniband/ulp/srpt/ib_srpt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
> index dcd810c..5bc8d57 100644
> --- a/drivers/infiniband/ulp/srpt/ib_srpt.c
> +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
> @@ -648,7 +648,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(ring_size * sizeof(ring[0]), GFP_KERNEL);
> +	ring = vmalloc(ring_size * sizeof(ring[0]));
>  	if (!ring)
>  		goto out;
>  	for (i = 0; i < ring_size; ++i) {
> @@ -679,7 +679,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);
> +	vfree(ioctx_ring);
>  }
>
>  /**
>


More information about the Devel mailing list