[Devel] [PATCH RHEL7 COMMIT] i40iw: use kvzalloc to allocate array of control qp requests

Konstantin Khorenko khorenko at virtuozzo.com
Tue Feb 26 13:22:32 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.1.3.vz7.83.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.1.3.vz7.83.14
------>
commit 8d04a6f7c4d7d85e44fb4e93cafaf9a5a8f00759
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Tue Feb 26 13:22:30 2019 +0300

    i40iw: use kvzalloc to allocate array of control qp requests
    
    Fixes the following:
    
     WARNING: CPU: 8 PID: 1711 at mm/page_alloc.c:3531 __alloc_pages_nodemask+0x311/0x610
     order 8 >= 3, gfp 0xc0d0
     Call Trace:
      [<ffffffff9e391fd8>] dump_stack+0x19/0x1b
      [<ffffffff9dc98778>] __warn+0xd8/0x100
      [<ffffffff9dc987ff>] warn_slowpath_fmt+0x5f/0x80
      [<ffffffff9ddd4371>] __alloc_pages_nodemask+0x311/0x610
      [<ffffffff9de26a78>] alloc_pages_current+0x98/0x110
      [<ffffffff9ddf1ae8>] kmalloc_order+0x18/0x40
      [<ffffffff9ddf1b36>] kmalloc_order_trace+0x26/0xa0
      [<ffffffff9de35ce1>] __kmalloc+0x281/0x2a0
      [<ffffffffc08efeb9>] i40iw_open.part.10+0x4b9/0x17f0 [i40iw]
      [<ffffffffc08f122b>] i40iw_open+0x3b/0x50 [i40iw]
      [<ffffffffc04f19cd>] i40e_client_subtask+0xbd/0x130 [i40e]
      [<ffffffffc04d408f>] i40e_service_task+0x62f/0x1360 [i40e]
      [<ffffffff9dcbc1e2>] process_one_work+0x182/0x440
      [<ffffffff9dcbd396>] worker_thread+0x126/0x3c0
      [<ffffffff9dcc4401>] kthread+0xd1/0xe0
      [<ffffffff9e3a4cf7>] ret_from_fork_nospec_begin+0x21/0x21
    
    https://pmc.acronis.com/browse/VSTOR-20675
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 drivers/infiniband/hw/i40iw/i40iw_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/i40iw/i40iw_main.c b/drivers/infiniband/hw/i40iw/i40iw_main.c
index b93ac14043e6..fad8d41efd1d 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_main.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_main.c
@@ -250,7 +250,7 @@ static void i40iw_destroy_cqp(struct i40iw_device *iwdev, bool free_hwcqp)
 	kfree(cqp->scratch_array);
 	iwdev->cqp.scratch_array = NULL;
 
-	kfree(cqp->cqp_requests);
+	kvfree(cqp->cqp_requests);
 	cqp->cqp_requests = NULL;
 }
 
@@ -565,12 +565,12 @@ static enum i40iw_status_code i40iw_create_cqp(struct i40iw_device *iwdev)
 	u16 maj_err, min_err;
 	int i;
 
-	cqp->cqp_requests = kcalloc(sqsize, sizeof(*cqp->cqp_requests), GFP_KERNEL);
+	cqp->cqp_requests = kvzalloc(sqsize * sizeof(*cqp->cqp_requests), GFP_KERNEL);
 	if (!cqp->cqp_requests)
 		return I40IW_ERR_NO_MEMORY;
 	cqp->scratch_array = kcalloc(sqsize, sizeof(*cqp->scratch_array), GFP_KERNEL);
 	if (!cqp->scratch_array) {
-		kfree(cqp->cqp_requests);
+		kvfree(cqp->cqp_requests);
 		return I40IW_ERR_NO_MEMORY;
 	}
 	dev->cqp = &cqp->sc_cqp;



More information about the Devel mailing list