* RE: [PATCH net-next] liquidio: Replace vmalloc with kmalloc in octeon_register_dispatch_fn()
@ 2020-07-30 18:58 Derek Chickles
0 siblings, 0 replies; 3+ messages in thread
From: Derek Chickles @ 2020-07-30 18:58 UTC (permalink / raw)
To: Wang Hai, joe, Satananda Burla, Felix Manlunas, davem, kuba
Cc: netdev, linux-kernel
> From: Wang Hai <wanghai38@huawei.com>
> Sent: Wednesday, July 29, 2020 11:12 PM
> To: joe@perches.com; Derek Chickles <dchickles@marvell.com>; Satananda
> Burla <sburla@marvell.com>; Felix Manlunas <fmanlunas@marvell.com>;
> davem@davemloft.net; kuba@kernel.org
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [EXT] [PATCH net-next] liquidio: Replace vmalloc with kmalloc in
> octeon_register_dispatch_fn()
>
> The size of struct octeon_dispatch is too small, it is better to use kmalloc
> instead of vmalloc.
>
> Suggested-by: Joe Perches <joe@perches.com>
> Signed-off-by: Wang Hai <wanghai38@huawei.com>
> ---
> drivers/net/ethernet/cavium/liquidio/octeon_device.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_device.c
> b/drivers/net/ethernet/cavium/liquidio/octeon_device.c
> index 934115d18488..ac32facaa427 100644
> --- a/drivers/net/ethernet/cavium/liquidio/octeon_device.c
> +++ b/drivers/net/ethernet/cavium/liquidio/octeon_device.c
> @@ -1056,7 +1056,7 @@ void octeon_delete_dispatch_list(struct
> octeon_device *oct)
>
> list_for_each_safe(temp, tmp2, &freelist) {
> list_del(temp);
> - vfree(temp);
> + kfree(temp);
> }
> }
>
> @@ -1152,13 +1152,10 @@ octeon_register_dispatch_fn(struct
> octeon_device *oct,
>
> dev_dbg(&oct->pci_dev->dev,
> "Adding opcode to dispatch list linked list\n");
> - dispatch = (struct octeon_dispatch *)
> - vmalloc(sizeof(struct octeon_dispatch));
> - if (!dispatch) {
> - dev_err(&oct->pci_dev->dev,
> - "No memory to add dispatch function\n");
> + dispatch = kmalloc(sizeof(*dispatch), GFP_KERNEL);
> + if (!dispatch)
> return 1;
> - }
> +
> dispatch->opcode = combined_opcode;
> dispatch->dispatch_fn = fn;
> dispatch->arg = fn_arg;
> --
> 2.17.1
Looks good.
Reviewed-by: Derek Chickles <dchickles@marvell.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] liquidio: Replace vmalloc with kmalloc in octeon_register_dispatch_fn()
2020-07-30 6:11 Wang Hai
@ 2020-07-31 0:40 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2020-07-31 0:40 UTC (permalink / raw)
To: wanghai38; +Cc: joe, dchickles, sburla, fmanlunas, kuba, netdev, linux-kernel
From: Wang Hai <wanghai38@huawei.com>
Date: Thu, 30 Jul 2020 14:11:40 +0800
> The size of struct octeon_dispatch is too small, it is better to use
> kmalloc instead of vmalloc.
>
> Suggested-by: Joe Perches <joe@perches.com>
> Signed-off-by: Wang Hai <wanghai38@huawei.com>
Applied, thank you.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH net-next] liquidio: Replace vmalloc with kmalloc in octeon_register_dispatch_fn()
@ 2020-07-30 6:11 Wang Hai
2020-07-31 0:40 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Wang Hai @ 2020-07-30 6:11 UTC (permalink / raw)
To: joe, dchickles, sburla, fmanlunas, davem, kuba; +Cc: netdev, linux-kernel
The size of struct octeon_dispatch is too small, it is better to use
kmalloc instead of vmalloc.
Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
---
drivers/net/ethernet/cavium/liquidio/octeon_device.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_device.c b/drivers/net/ethernet/cavium/liquidio/octeon_device.c
index 934115d18488..ac32facaa427 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_device.c
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_device.c
@@ -1056,7 +1056,7 @@ void octeon_delete_dispatch_list(struct octeon_device *oct)
list_for_each_safe(temp, tmp2, &freelist) {
list_del(temp);
- vfree(temp);
+ kfree(temp);
}
}
@@ -1152,13 +1152,10 @@ octeon_register_dispatch_fn(struct octeon_device *oct,
dev_dbg(&oct->pci_dev->dev,
"Adding opcode to dispatch list linked list\n");
- dispatch = (struct octeon_dispatch *)
- vmalloc(sizeof(struct octeon_dispatch));
- if (!dispatch) {
- dev_err(&oct->pci_dev->dev,
- "No memory to add dispatch function\n");
+ dispatch = kmalloc(sizeof(*dispatch), GFP_KERNEL);
+ if (!dispatch)
return 1;
- }
+
dispatch->opcode = combined_opcode;
dispatch->dispatch_fn = fn;
dispatch->arg = fn_arg;
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-31 0:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-30 18:58 [PATCH net-next] liquidio: Replace vmalloc with kmalloc in octeon_register_dispatch_fn() Derek Chickles
-- strict thread matches above, loose matches on Subject: below --
2020-07-30 6:11 Wang Hai
2020-07-31 0:40 ` 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).