lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 20 Jan 2022 22:09:30 +0800
From:   Tony Lu <tonylu@...ux.alibaba.com>
To:     kgraul@...ux.ibm.com
Cc:     kuba@...nel.org, davem@...emloft.net, netdev@...r.kernel.org,
        linux-s390@...r.kernel.org
Subject: [PATCH net-next] net/smc: Use kvzalloc for allocating smc_link_group

When analyzed memory usage of SMC, we found that the size of struct
smc_link_group is 16048 bytes, which is too big for a busy machine to
allocate contiguous memory. Using kvzalloc instead that falls back to
vmalloc if there has not enough contiguous memory.

Signed-off-by: Tony Lu <tonylu@...ux.alibaba.com>
---
 net/smc/smc_core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index 8935ef4811b0..a5024b098540 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -828,7 +828,7 @@ static int smc_lgr_create(struct smc_sock *smc, struct smc_init_info *ini)
 		}
 	}
 
-	lgr = kzalloc(sizeof(*lgr), GFP_KERNEL);
+	lgr = kvzalloc(sizeof(*lgr), GFP_KERNEL);
 	if (!lgr) {
 		rc = SMC_CLC_DECL_MEM;
 		goto ism_put_vlan;
@@ -914,7 +914,7 @@ static int smc_lgr_create(struct smc_sock *smc, struct smc_init_info *ini)
 free_wq:
 	destroy_workqueue(lgr->tx_wq);
 free_lgr:
-	kfree(lgr);
+	kvfree(lgr);
 ism_put_vlan:
 	if (ini->is_smcd && ini->vlan_id)
 		smc_ism_put_vlan(ini->ism_dev[ini->ism_selected], ini->vlan_id);
@@ -1317,7 +1317,7 @@ static void smc_lgr_free(struct smc_link_group *lgr)
 		if (!atomic_dec_return(&lgr_cnt))
 			wake_up(&lgrs_deleted);
 	}
-	kfree(lgr);
+	kvfree(lgr);
 }
 
 static void smc_sk_wake_ups(struct smc_sock *smc)
-- 
2.32.0.3.g01195cf9f

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ