From: Tariq Toukan <ttoukan.linux@gmail.com>
To: Eric Dumazet <edumazet@google.com>
Cc: YueHaibing <yuehaibing@huawei.com>,
borisp@nvidia.com, saeedm@nvidia.com, leon@kernel.org,
davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
lkayal@nvidia.com, tariqt@nvidia.com, markzhang@nvidia.com,
netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] net/mlx5e: Use kvfree() in mlx5e_accel_fs_tcp_create()
Date: Thu, 10 Nov 2022 09:31:00 +0200 [thread overview]
Message-ID: <ba0c84f1-1d99-c0e4-111d-bbd14047ca0b@gmail.com> (raw)
In-Reply-To: <CANn89iKqm9=uyoymd9OvASjnazQVKVW1kwOxhpazxv_FGaVpFg@mail.gmail.com>
On 11/8/2022 9:45 PM, Eric Dumazet wrote:
> On Tue, Nov 8, 2022 at 9:58 AM Tariq Toukan <ttoukan.linux@gmail.com> wrote:
>>
>>
>>
>> On 11/8/2022 4:06 PM, YueHaibing wrote:
>>> 'accel_tcp' is allocted by kvzalloc(), which should freed by kvfree().
>>>
>>> Fixes: f52f2faee581 ("net/mlx5e: Introduce flow steering API")
>>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>>> ---
>>> v2: fix the same issue in mlx5e_accel_fs_tcp_destroy() and a commit log typo
>>> ---
>>> drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
>>> index 285d32d2fd08..d7c020f72401 100644
>>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
>>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
>>> @@ -365,7 +365,7 @@ void mlx5e_accel_fs_tcp_destroy(struct mlx5e_flow_steering *fs)
>>> for (i = 0; i < ACCEL_FS_TCP_NUM_TYPES; i++)
>>> accel_fs_tcp_destroy_table(fs, i);
>>>
>>> - kfree(accel_tcp);
>>> + kvfree(accel_tcp);
>>> mlx5e_fs_set_accel_tcp(fs, NULL);
>>> }
>>>
>>> @@ -397,7 +397,7 @@ int mlx5e_accel_fs_tcp_create(struct mlx5e_flow_steering *fs)
>>> err_destroy_tables:
>>> while (--i >= 0)
>>> accel_fs_tcp_destroy_table(fs, i);
>>> - kfree(accel_tcp);
>>> + kvfree(accel_tcp);
>>> mlx5e_fs_set_accel_tcp(fs, NULL);
>>> return err;
>>> }
>>
>> Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
>>
>> Thanks for your patch.
>
> Although this structure is 64 bytes... Not sure why kvmalloc() has
> been used for this small chunk.
It's a small chunk indeed. Unnecessary usage of kvmalloc.
Although it's not critical (used only in slowpath), it'd be nice to
clean it up and directly call kzalloc, instead of aligning the kfree().
YueHaibing, can you please submit a v3 for this?
Regards,
Tariq
next prev parent reply other threads:[~2022-11-10 7:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-08 14:06 [PATCH v2] net/mlx5e: Use kvfree() in mlx5e_accel_fs_tcp_create() YueHaibing
2022-11-08 17:58 ` Tariq Toukan
2022-11-08 19:45 ` Eric Dumazet
2022-11-10 7:31 ` Tariq Toukan [this message]
2022-11-10 11:04 ` YueHaibing
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=ba0c84f1-1d99-c0e4-111d-bbd14047ca0b@gmail.com \
--to=ttoukan.linux@gmail.com \
--cc=borisp@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=lkayal@nvidia.com \
--cc=markzhang@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
--cc=yuehaibing@huawei.com \
/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