[RHEL7,COMMIT] i40iw: use kvzalloc for large allocation of iwdev->mem_resources

Submitted by Konstantin Khorenko on June 14, 2019, 4:24 p.m.

Details

Message ID 201906141624.x5EGOAiS009653@finist-ce7.sw.ru
State New
Series "i40iw: use kvzalloc for large allocation of iwdev->mem_resources"
Headers show

Commit Message

Konstantin Khorenko June 14, 2019, 4:24 p.m.
The commit is pushed to "branch-rh7-3.10.0-957.21.2.vz7.105.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.21.2.vz7.97.1
------>
commit bebf1a871f8ae01e168dbeac228862a57b6e613d
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Fri Jun 14 19:24:10 2019 +0300

    i40iw: use kvzalloc for large allocation of iwdev->mem_resources
    
    10-order allocation needed for iwdev->mem_resources in
    i40iw_initialize_hw_resources() may easily fail under memory fragmentation.
    Use kvzalloc to fallback to 0-order pages when high order aren't available.
    
    https://pmc.acronis.com/browse/VSTOR-23649
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 drivers/infiniband/hw/i40iw/i40iw_hw.c   | 2 +-
 drivers/infiniband/hw/i40iw/i40iw_main.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/infiniband/hw/i40iw/i40iw_hw.c b/drivers/infiniband/hw/i40iw/i40iw_hw.c
index 6139836fb533..318cb390c1c5 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_hw.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_hw.c
@@ -70,7 +70,7 @@  u32 i40iw_initialize_hw_resources(struct i40iw_device *iwdev)
 	resources_size += sizeof(unsigned long) * BITS_TO_LONGS(num_pds);
 	resources_size += sizeof(unsigned long) * BITS_TO_LONGS(arp_table_size);
 	resources_size += sizeof(struct i40iw_qp **) * max_qp;
-	iwdev->mem_resources = kzalloc(resources_size, GFP_KERNEL);
+	iwdev->mem_resources = kvzalloc(resources_size, GFP_KERNEL);
 
 	if (!iwdev->mem_resources)
 		return -ENOMEM;
diff --git a/drivers/infiniband/hw/i40iw/i40iw_main.c b/drivers/infiniband/hw/i40iw/i40iw_main.c
index cc19eb328a13..f20599e5b4ce 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_main.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_main.c
@@ -1027,7 +1027,7 @@  static void i40iw_del_init_mem(struct i40iw_device *iwdev)
 	i40iw_free_dma_mem(&iwdev->hw, &iwdev->obj_mem);
 	kfree(dev->hmc_info->sd_table.sd_entry);
 	dev->hmc_info->sd_table.sd_entry = NULL;
-	kfree(iwdev->mem_resources);
+	kvfree(iwdev->mem_resources);
 	iwdev->mem_resources = NULL;
 	kfree(iwdev->ceqlist);
 	iwdev->ceqlist = NULL;