Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 781a4016 authored by Jan Dakinevich's avatar Jan Dakinevich Committed by Jason Gunthorpe
Browse files

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: default avatarJan Dakinevich <jan.dakinevich@virtuozzo.com>
Reviewed-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 8942acea
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -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);
}
}


/**
/**