mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
ib_srpt: use kvmalloc to allocate ring pointers
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. Signed-off-by: Jan Dakinevich <jan.dakinevich@virtuozzo.com> Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
parent
8942acea37
commit
781a4016be
1 changed files with 3 additions and 3 deletions
|
@ -719,7 +719,7 @@ static struct srpt_ioctx **srpt_alloc_ioctx_ring(struct srpt_device *sdev,
|
||||||
WARN_ON(ioctx_size != sizeof(struct srpt_recv_ioctx)
|
WARN_ON(ioctx_size != sizeof(struct srpt_recv_ioctx)
|
||||||
&& ioctx_size != sizeof(struct srpt_send_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)
|
if (!ring)
|
||||||
goto out;
|
goto out;
|
||||||
for (i = 0; i < ring_size; ++i) {
|
for (i = 0; i < ring_size; ++i) {
|
||||||
|
@ -733,7 +733,7 @@ static struct srpt_ioctx **srpt_alloc_ioctx_ring(struct srpt_device *sdev,
|
||||||
err:
|
err:
|
||||||
while (--i >= 0)
|
while (--i >= 0)
|
||||||
srpt_free_ioctx(sdev, ring[i], dma_size, dir);
|
srpt_free_ioctx(sdev, ring[i], dma_size, dir);
|
||||||
kfree(ring);
|
kvfree(ring);
|
||||||
ring = NULL;
|
ring = NULL;
|
||||||
out:
|
out:
|
||||||
return ring;
|
return ring;
|
||||||
|
@ -758,7 +758,7 @@ static void srpt_free_ioctx_ring(struct srpt_ioctx **ioctx_ring,
|
||||||
|
|
||||||
for (i = 0; i < ring_size; ++i)
|
for (i = 0; i < ring_size; ++i)
|
||||||
srpt_free_ioctx(sdev, ioctx_ring[i], dma_size, dir);
|
srpt_free_ioctx(sdev, ioctx_ring[i], dma_size, dir);
|
||||||
kfree(ioctx_ring);
|
kvfree(ioctx_ring);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue