From patchwork Wed Oct 28 18:21:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kozyrev X-Patchwork-Id: 82678 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5EB40A04DD; Wed, 28 Oct 2020 19:21:06 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0B0C14C9B; Wed, 28 Oct 2020 19:21:05 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 910C84C8B for ; Wed, 28 Oct 2020 19:21:02 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from akozyrev@nvidia.com) with SMTP; 28 Oct 2020 20:21:01 +0200 Received: from nvidia.com (pegasus02.mtr.labs.mlnx [10.210.16.122]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 09SIL1H3009598; Wed, 28 Oct 2020 20:21:01 +0200 From: Alexander Kozyrev To: dev@dpdk.org Cc: rasland@nvidia.com, viacheslavo@nvidia.com, matan@nvidia.com Date: Wed, 28 Oct 2020 18:21:00 +0000 Message-Id: <20201028182100.12312-1-akozyrev@nvidia.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] common/mlx5: fix memory allocation debug stats X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Fix compilation issue for memory allocation stats in case of the RTE_LIBRTE_MLX5_DEBUG is enabled. The mlx5_sys_mem is static and its members should be accessed via member operator, not a pointer. Fixes: 1f34e138f8 ("common/mlx5: use C11 atomics for memory allocation") Signed-off-by: Alexander Kozyrev --- drivers/common/mlx5/mlx5_malloc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/common/mlx5/mlx5_malloc.c b/drivers/common/mlx5/mlx5_malloc.c index f64c15fceb..5a3267f730 100644 --- a/drivers/common/mlx5/mlx5_malloc.c +++ b/drivers/common/mlx5/mlx5_malloc.c @@ -187,7 +187,7 @@ mlx5_malloc(uint32_t flags, size_t size, unsigned int align, int socket) mlx5_mem_update_msl(addr); #ifdef RTE_LIBRTE_MLX5_DEBUG if (addr) - __atomic_add_fetch(&mlx5_sys_mem->malloc_rte, 1, + __atomic_add_fetch(&mlx5_sys_mem.malloc_rte, 1, __ATOMIC_RELAXED); #endif return addr; @@ -201,7 +201,7 @@ mlx5_malloc(uint32_t flags, size_t size, unsigned int align, int socket) addr = malloc(size); #ifdef RTE_LIBRTE_MLX5_DEBUG if (addr) - __atomic_add_fetch(&mlx5_sys_mem->malloc_sys, 1, + __atomic_add_fetch(&mlx5_sys_mem.malloc_sys, 1, __ATOMIC_RELAXED); #endif return addr; @@ -235,7 +235,7 @@ mlx5_realloc(void *addr, uint32_t flags, size_t size, unsigned int align, mlx5_mem_update_msl(new_addr); #ifdef RTE_LIBRTE_MLX5_DEBUG if (new_addr) - __atomic_add_fetch(&mlx5_sys_mem->realloc_rte, 1, + __atomic_add_fetch(&mlx5_sys_mem.realloc_rte, 1, __ATOMIC_RELAXED); #endif return new_addr; @@ -248,7 +248,7 @@ mlx5_realloc(void *addr, uint32_t flags, size_t size, unsigned int align, new_addr = realloc(addr, size); #ifdef RTE_LIBRTE_MLX5_DEBUG if (new_addr) - __atomic_add_fetch(&mlx5_sys_mem->realloc_sys, 1, + __atomic_add_fetch(&mlx5_sys_mem.realloc_sys, 1, __ATOMIC_RELAXED); #endif return new_addr; @@ -261,13 +261,13 @@ mlx5_free(void *addr) return; if (!mlx5_mem_is_rte(addr)) { #ifdef RTE_LIBRTE_MLX5_DEBUG - __atomic_add_fetch(&mlx5_sys_mem->free_sys, 1, + __atomic_add_fetch(&mlx5_sys_mem.free_sys, 1, __ATOMIC_RELAXED); #endif free(addr); } else { #ifdef RTE_LIBRTE_MLX5_DEBUG - __atomic_add_fetch(&mlx5_sys_mem->free_rte, 1, + __atomic_add_fetch(&mlx5_sys_mem.free_rte, 1, __ATOMIC_RELAXED); #endif rte_free(addr);