IB/hfi1: Take advantage of kvzalloc_node in sdma initialization
authorMike Marciniszyn <mike.marciniszyn@intel.com>
Mon, 23 Oct 2017 13:06:32 +0000 (06:06 -0700)
committerDoug Ledford <dledford@redhat.com>
Mon, 30 Oct 2017 18:51:36 +0000 (14:51 -0400)
The code that allocates the tx ring in the sdma code fails to take
advantage of kvzalloc variations.

Fix by converting to use kvzalloc_node.

Reported-by: Leon Romanovsky <leon@kernel.org>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/hfi1/sdma.c

index 78716b8..6a1b8e4 100644 (file)
@@ -1465,13 +1465,8 @@ int sdma_init(struct hfi1_devdata *dd, u8 port)
                if (!sde->descq)
                        goto bail;
                sde->tx_ring =
-                       kcalloc(descq_cnt, sizeof(struct sdma_txreq *),
-                               GFP_KERNEL);
-               if (!sde->tx_ring)
-                       sde->tx_ring =
-                               vzalloc(
-                                       sizeof(struct sdma_txreq *) *
-                                       descq_cnt);
+                       kvzalloc_node(sizeof(struct sdma_txreq *) * descq_cnt,
+                                     GFP_KERNEL, dd->node);
                if (!sde->tx_ring)
                        goto bail;
        }