* [PATCH] cnic: use kvzalloc to allocate memory for csk_tbl
@ 2018-07-09 13:51 Jan Dakinevich
2018-07-12 5:56 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Jan Dakinevich @ 2018-07-09 13:51 UTC (permalink / raw)
To: David S. Miller, Jan Dakinevich, Christophe JAILLET,
Dan Carpenter, Kees Cook, netdev, linux-kernel
Cc: Denis Lunev, Konstantin Khorenko
Size of csk_tbl is about 58K, which means 3rd order page allocation.
kvzalloc provides a fallback if no high order memory is available.
Signed-off-by: Jan Dakinevich <jan.dakinevich@virtuozzo.com>
---
drivers/net/ethernet/broadcom/cnic.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c
index 4fd829b..1bc5d4b 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,8 +4100,8 @@ static int cnic_cm_alloc_mem(struct cnic_dev *dev)
struct cnic_local *cp = dev->cnic_priv;
u32 port_id;
- cp->csk_tbl = kcalloc(MAX_CM_SK_TBL_SZ, sizeof(struct cnic_sock),
- GFP_KERNEL);
+ cp->csk_tbl = kvcalloc(MAX_CM_SK_TBL_SZ, sizeof(struct cnic_sock),
+ GFP_KERNEL);
if (!cp->csk_tbl)
return -ENOMEM;
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] cnic: use kvzalloc to allocate memory for csk_tbl
2018-07-09 13:51 [PATCH] cnic: use kvzalloc to allocate memory for csk_tbl Jan Dakinevich
@ 2018-07-12 5:56 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-07-12 5:56 UTC (permalink / raw)
To: jan.dakinevich
Cc: christophe.jaillet, dan.carpenter, keescook, netdev,
linux-kernel, den, khorenko
From: Jan Dakinevich <jan.dakinevich@virtuozzo.com>
Date: Mon, 9 Jul 2018 16:51:19 +0300
> Size of csk_tbl is about 58K, which means 3rd order page allocation.
> kvzalloc provides a fallback if no high order memory is available.
>
> Signed-off-by: Jan Dakinevich <jan.dakinevich@virtuozzo.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-12 5:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-09 13:51 [PATCH] cnic: use kvzalloc to allocate memory for csk_tbl Jan Dakinevich
2018-07-12 5:56 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).