From: Tony Lu <tonylu@linux.alibaba.com>
To: kgraul@linux.ibm.com
Cc: kuba@kernel.org, davem@davemloft.net, netdev@vger.kernel.org,
linux-s390@vger.kernel.org
Subject: [PATCH net-next] net/smc: Use kvzalloc for allocating smc_link_group
Date: Thu, 20 Jan 2022 22:09:30 +0800 [thread overview]
Message-ID: <20220120140928.7137-1-tonylu@linux.alibaba.com> (raw)
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@linux.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
next reply other threads:[~2022-01-20 14:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-20 14:09 Tony Lu [this message]
2022-01-20 14:50 ` [PATCH net-next] net/smc: Use kvzalloc for allocating smc_link_group Karsten Graul
2022-01-21 3:24 ` Tony Lu
2022-01-21 11:06 ` Karsten Graul
2022-01-24 9:46 ` Tony Lu
2022-01-27 15:28 ` Karsten Graul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220120140928.7137-1-tonylu@linux.alibaba.com \
--to=tonylu@linux.alibaba.com \
--cc=davem@davemloft.net \
--cc=kgraul@linux.ibm.com \
--cc=kuba@kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox