[Devel] [PATCH RHEL7 COMMIT] ib_srpt: replay the rework of buffer allocation

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jul 6 13:01:49 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.3.2.vz7.61.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.3.2.vz7.61.15
------>
commit 2bc433f07bf2482762587b86de0896a9aab05b03
Author: Jan Dakinevich <jan.dakinevich at virtuozzo.com>
Date:   Fri Jul 6 13:01:49 2018 +0300

    ib_srpt: replay the rework of buffer allocation
    
    Previously, kfree was accidentally missed in srpt_alloc_ioctx_ring. Also, taking
    into the comments, kvmalloc now is used instead of vmalloc.
    
    Fixes: 479860d ("ib/srpt: use vmalloc to allocate ring pointers")
    
    https://jira.sw.ru/browse/HCI-100
    Signed-off-by: Jan Dakinevich <jan.dakinevich at 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 5bc8d57256e2..32b7fb71e62d 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 = vmalloc(ring_size * sizeof(ring[0]));
+	ring = kvmalloc(ring_size * sizeof(ring[0]), GFP_KERNEL);
 	if (!ring)
 		goto out;
 	for (i = 0; i < ring_size; ++i) {
@@ -662,7 +662,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;
@@ -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);
-	vfree(ioctx_ring);
+	kvfree(ioctx_ring);
 }
 
 /**


More information about the Devel mailing list