[RHEL7,COMMIT] IPoIB: use kvzalloc to allocate an array of bucket pointers

Submitted by Konstantin Khorenko on July 6, 2018, 10:05 a.m.

Details

Message ID 201807061005.w66A5MfN015332@finist_ce7.work
State New
Series "IPoIB: use kvzalloc to allocate an array of bucket pointers"
Headers show

Commit Message

Konstantin Khorenko July 6, 2018, 10:05 a.m.
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 bfae1cdd8f0527f263c601733010f23b53e93146
Author: Jan Dakinevich <jan.dakinevich@virtuozzo.com>
Date:   Fri Jul 6 13:05:22 2018 +0300

    IPoIB: use kvzalloc to allocate an array of bucket pointers
    
    This table by default takes 32KiB which is 3rd memory order. Menwhile, this
    memory is not aimed for DMA operation and could be safely allocated by vmalloc.
    
    https://jira.sw.ru/browse/HCI-103
    Signed-off-by: Jan Dakinevich <jan.dakinevich@virtuozzo.com>
---
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 1634d37477fc..9efb260b968b 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1483,7 +1483,7 @@  static int ipoib_neigh_hash_init(struct ipoib_dev_priv *priv)
 		return -ENOMEM;
 	set_bit(IPOIB_STOP_NEIGH_GC, &priv->flags);
 	size = roundup_pow_of_two(arp_tbl.gc_thresh3);
-	buckets = kzalloc(size * sizeof(*buckets), GFP_KERNEL);
+	buckets = kvzalloc(size * sizeof(*buckets), GFP_KERNEL);
 	if (!buckets) {
 		kfree(htbl);
 		return -ENOMEM;
@@ -1511,7 +1511,7 @@  static void neigh_hash_free_rcu(struct rcu_head *head)
 	struct ipoib_neigh __rcu **buckets = htbl->buckets;
 	struct ipoib_neigh_table *ntbl = htbl->ntbl;
 
-	kfree(buckets);
+	kvfree(buckets);
 	kfree(htbl);
 	complete(&ntbl->deleted);
 }