All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: Use kfree(ft->g) in arfs_create_groups()
@ 2020-06-05 19:22 Denis Efremov
  2020-06-05 19:57 ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: Denis Efremov @ 2020-06-05 19:22 UTC (permalink / raw)
  To: Saeed Mahameed
  Cc: Denis Efremov, Leon Romanovsky, Jakub Kicinski, netdev, linux-kernel

Use kfree() instead of kvfree() on ft->g in arfs_create_groups() because
the memory is allocated with kcalloc().

Signed-off-by: Denis Efremov <efremov@linux.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c
index 014639ea06e3..c4c9d6cda7e6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c
@@ -220,7 +220,7 @@ static int arfs_create_groups(struct mlx5e_flow_table *ft,
 			sizeof(*ft->g), GFP_KERNEL);
 	in = kvzalloc(inlen, GFP_KERNEL);
 	if  (!in || !ft->g) {
-		kvfree(ft->g);
+		kfree(ft->g);
 		kvfree(in);
 		return -ENOMEM;
 	}
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net/mlx5: Use kfree(ft->g) in arfs_create_groups()
  2020-06-05 19:22 [PATCH] net/mlx5: Use kfree(ft->g) in arfs_create_groups() Denis Efremov
@ 2020-06-05 19:57 ` Eric Dumazet
  2020-06-11 22:08   ` Saeed Mahameed
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2020-06-05 19:57 UTC (permalink / raw)
  To: Denis Efremov, Saeed Mahameed
  Cc: Leon Romanovsky, Jakub Kicinski, netdev, linux-kernel



On 6/5/20 12:22 PM, Denis Efremov wrote:
> Use kfree() instead of kvfree() on ft->g in arfs_create_groups() because
> the memory is allocated with kcalloc().
> 
> Signed-off-by: Denis Efremov <efremov@linux.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c
> index 014639ea06e3..c4c9d6cda7e6 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c
> @@ -220,7 +220,7 @@ static int arfs_create_groups(struct mlx5e_flow_table *ft,
>  			sizeof(*ft->g), GFP_KERNEL);
>  	in = kvzalloc(inlen, GFP_KERNEL);
>  	if  (!in || !ft->g) {
> -		kvfree(ft->g);
> +		kfree(ft->g);
>  		kvfree(in);
>  		return -ENOMEM;
>  	}
> 

This is slow path, kvfree() is perfectly able to free memory that was kmalloc()ed

net-next is closed, can we avoid these patches during merge window ?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net/mlx5: Use kfree(ft->g) in arfs_create_groups()
  2020-06-05 19:57 ` Eric Dumazet
@ 2020-06-11 22:08   ` Saeed Mahameed
  0 siblings, 0 replies; 3+ messages in thread
From: Saeed Mahameed @ 2020-06-11 22:08 UTC (permalink / raw)
  To: efremov, eric.dumazet; +Cc: kuba, netdev, leon, linux-kernel

On Fri, 2020-06-05 at 12:57 -0700, Eric Dumazet wrote:
> 
> On 6/5/20 12:22 PM, Denis Efremov wrote:
> > Use kfree() instead of kvfree() on ft->g in arfs_create_groups()
> > because
> > the memory is allocated with kcalloc().
> > 
> > Signed-off-by: Denis Efremov <efremov@linux.com>
> > ---
> >  drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c
> > b/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c
> > index 014639ea06e3..c4c9d6cda7e6 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c
> > @@ -220,7 +220,7 @@ static int arfs_create_groups(struct
> > mlx5e_flow_table *ft,
> >  			sizeof(*ft->g), GFP_KERNEL);
> >  	in = kvzalloc(inlen, GFP_KERNEL);
> >  	if  (!in || !ft->g) {
> > -		kvfree(ft->g);
> > +		kfree(ft->g);
> >  		kvfree(in);
> >  		return -ENOMEM;
> >  	}
> > 
> 
> This is slow path, kvfree() is perfectly able to free memory that was
> kmalloc()ed
> 
> net-next is closed, can we avoid these patches during merge window ?

I agree, with Eric, better if we wait for net-next to open.

I will apply this once net-next is open. 

Thanks,
Saeed.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-11 22:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-05 19:22 [PATCH] net/mlx5: Use kfree(ft->g) in arfs_create_groups() Denis Efremov
2020-06-05 19:57 ` Eric Dumazet
2020-06-11 22:08   ` Saeed Mahameed

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.