[Devel] [PATCH RHEL7 COMMIT] IB/core: use kvzalloc to allocate ib_device

Konstantin Khorenko khorenko at virtuozzo.com
Fri Sep 28 12:24:05 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.14.4.vz7.72.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.14.4.vz7.72.1
------>
commit 7629b2cc58ee8d2ec0bac4ab19fa7e7c887d4d41
Author: Jan Dakinevich <jan.dakinevich at virtuozzo.com>
Date:   Fri Sep 28 12:24:02 2018 +0300

    IB/core: use kvzalloc to allocate ib_device
    
    The allocator ib_alloc_device() is used to allocate both ib_device and
    device specific instance. This allocations sometimes quite big and
    takes tens KiB, causing high page orders.
    
    Meanwhile, the memory is not intended for DMA and doesn't require to be
    physically contiguous.
    
    https://jira.sw.ru/browse/HCI-129
    Signed-off-by: Jan Dakinevich <jan.dakinevich at virtuozzo.com>
---
 drivers/infiniband/core/device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index cc744653f1c4..2a6b89db9323 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -202,7 +202,7 @@ static void ib_device_release(struct device *device)
 		ib_cache_release_one(dev);
 		kfree(dev->port_immutable);
 	}
-	kfree(dev);
+	kvfree(dev);
 }
 
 static int ib_device_uevent(struct device *device,
@@ -243,7 +243,7 @@ struct ib_device *ib_alloc_device(size_t size)
 	if (WARN_ON(size < sizeof(struct ib_device)))
 		return NULL;
 
-	device = kzalloc(size, GFP_KERNEL);
+	device = kvzalloc(size, GFP_KERNEL);
 	if (!device)
 		return NULL;
 



More information about the Devel mailing list