[Devel] [PATCH RHEL7 COMMIT] cnic: use kvzalloc to allocate memory for csk_tbl

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jun 15 14:57:13 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-693.21.1.vz7.50.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.21.1.vz7.50.9
------>
commit 491b436f98ace923b0c80fed96cddbcdf1e0c8ea
Author: Jan Dakinevich <jan.dakinevich at virtuozzo.com>
Date:   Fri Jun 15 14:57:13 2018 +0300

    cnic: use kvzalloc to allocate memory for csk_tbl
    
    Size of csk_tbl is about 58K, which means 3rd order page allocation.
    kvzalloc provides a fallback if no high order memory is available.
    
    https://jira.sw.ru/browse/PSBM-85534
    Signed-off-by: Jan Dakinevich <jan.dakinevich at virtuozzo.com>
---
 drivers/net/ethernet/broadcom/cnic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c
index 6aa58168a175..64556ccfbd5a 100644
--- a/drivers/net/ethernet/broadcom/cnic.c
+++ b/drivers/net/ethernet/broadcom/cnic.c
@@ -4090,7 +4090,7 @@ static void cnic_cm_free_mem(struct cnic_dev *dev)
 {
 	struct cnic_local *cp = dev->cnic_priv;
 
-	kfree(cp->csk_tbl);
+	kvfree(cp->csk_tbl);
 	cp->csk_tbl = NULL;
 	cnic_free_id_tbl(&cp->csk_port_tbl);
 }
@@ -4100,7 +4100,7 @@ static int cnic_cm_alloc_mem(struct cnic_dev *dev)
 	struct cnic_local *cp = dev->cnic_priv;
 	u32 port_id;
 
-	cp->csk_tbl = kzalloc(sizeof(struct cnic_sock) * MAX_CM_SK_TBL_SZ,
+	cp->csk_tbl = kvzalloc(sizeof(struct cnic_sock) * MAX_CM_SK_TBL_SZ,
 			      GFP_KERNEL);
 	if (!cp->csk_tbl)
 		return -ENOMEM;


More information about the Devel mailing list