From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90A76C4332F for ; Thu, 10 Nov 2022 11:04:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229920AbiKJLEh (ORCPT ); Thu, 10 Nov 2022 06:04:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229951AbiKJLEg (ORCPT ); Thu, 10 Nov 2022 06:04:36 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7338F6C738; Thu, 10 Nov 2022 03:04:35 -0800 (PST) Received: from canpemm500007.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4N7Jqq5PnjzHvp7; Thu, 10 Nov 2022 19:04:07 +0800 (CST) Received: from [10.174.179.215] (10.174.179.215) by canpemm500007.china.huawei.com (7.192.104.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 10 Nov 2022 19:04:32 +0800 Subject: Re: [PATCH v2] net/mlx5e: Use kvfree() in mlx5e_accel_fs_tcp_create() To: Tariq Toukan , Eric Dumazet CC: , , , , , , , , , , , References: <20221108140614.12968-1-yuehaibing@huawei.com> From: YueHaibing Message-ID: <611b2e05-0aca-68e3-b219-e851ce9eadd0@huawei.com> Date: Thu, 10 Nov 2022 19:04:32 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.179.215] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500007.china.huawei.com (7.192.104.62) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On 2022/11/10 15:31, Tariq Toukan wrote: > > > On 11/8/2022 9:45 PM, Eric Dumazet wrote: >> On Tue, Nov 8, 2022 at 9:58 AM Tariq Toukan 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 >>>> --- >>>> 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 >>> >>> 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? Sure, will resend. > > Regards, > Tariq > .