From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D843C4548E; Tue, 18 Jun 2024 16:45:29 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E1AA640EDB; Tue, 18 Jun 2024 16:45:21 +0200 (CEST) Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by mails.dpdk.org (Postfix) with ESMTP id 6137B40E40 for ; Tue, 18 Jun 2024 16:45:19 +0200 (CEST) Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1f480624d0dso44147675ad.1 for ; Tue, 18 Jun 2024 07:45:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1718721918; x=1719326718; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JIu1hCn6HzyqqAUw8Fil0Uc6jTZEIMKq2UWxqyqpsjY=; b=ipC70krCaH75qHio2qadixXyaWf5ZhypE6QOVHoLSpHN9rbcH2FyHDRQoSjzzNXz2y RflumvNwHBU8iPNu+qI3vGC7KUcHsuPSAi//cktIPIwmXMYagWhxvgRKo3L5RQu1n1/4 UpdBi7Efp8A4eRBTcJdUhMHcXw+45bMNJgT0iERP9bifrAuPArI0tKVNpiWG4fMU1zAH 75xHuvCrRlrzvIqbTpPMaSk5TpwyfKJZgsYhI72pZz96KnDTbA8IrGphDe+NTcb3WIvp VP0wNqSsNkEkkgiKyJcY5J7Q5lPR4CIZK7m/296e22caEk85Y259WdtjWoQciUQ/BHH9 V5NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718721918; x=1719326718; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JIu1hCn6HzyqqAUw8Fil0Uc6jTZEIMKq2UWxqyqpsjY=; b=TXNO0fit0/Z2FbwxShUCnKV1OBdJ4xn9tHuKlLE3LeVua5Kh3fvtqxQFzSotSWnzF6 DS9qNBKkDk/YQuQAzZT3eQLAzRIvLxZx+dCOtdbZe2yMOmJhYCemTeUqZby0R14gQOE/ uXbHa3pbZldC/O24fKuYLOAibDRekKQdV0cGC6eReYua6yXIEJhpH7LLrj/Ju2+73ztt vfAaxiW1TMWohk5jDu/RmPZEFSP9S1QY2mq6bGU2ZhelIcHsfPYBNDLcvxF2vnkgJkzo Z4XGVRhTJL31WarYtLCxb1bVWvCzc1Jo9Svq5PRcrOYkQbBXo3B/0oC/kS5MkW9Ykum6 fJ0w== X-Gm-Message-State: AOJu0Yybav1oQylWmL0sYg1tFQ62IZ1ZwCdBOmb9XiT+yNxkIVka7gv8 CkTmDFW9JhyVMg71tuSpVo1uO2OS5I330RVjNojm91LCTS/a8F+0bD92Zw87opFpHk7804tPoAk P X-Google-Smtp-Source: AGHT+IFGtfNJqAa/tcGYGlqtEJrHg7tIKItVL8g6p7JmbNvTxQskDThUh2P3ot0goqC9Aa45zJsHmA== X-Received: by 2002:a17:902:d2c4:b0:1f7:3332:65bf with SMTP id d9443c01a7336-1f8625ce785mr175443425ad.16.1718721918398; Tue, 18 Jun 2024 07:45:18 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f855e72483sm98589905ad.96.2024.06.18.07.45.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jun 2024 07:45:17 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v3 2/2] eal: remove type argument from internal routines Date: Tue, 18 Jun 2024 07:44:16 -0700 Message-ID: <20240618144507.73770-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240618144507.73770-1-stephen@networkplumber.org> References: <20240425182738.4771-1-stephen@networkplumber.org> <20240618144507.73770-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The type argument is carried through malloc heap routines but never used there. It is only used a rte_malloc for tracing. Signed-off-by: Stephen Hemminger --- lib/eal/common/eal_common_memzone.c | 6 ++--- lib/eal/common/malloc_heap.c | 39 ++++++++++++----------------- lib/eal/common/malloc_heap.h | 7 +++--- lib/eal/common/rte_malloc.c | 2 +- 4 files changed, 22 insertions(+), 32 deletions(-) diff --git a/lib/eal/common/eal_common_memzone.c b/lib/eal/common/eal_common_memzone.c index 32e6b78f87..2d9b6aa3e3 100644 --- a/lib/eal/common/eal_common_memzone.c +++ b/lib/eal/common/eal_common_memzone.c @@ -191,14 +191,12 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len, if (len == 0 && bound == 0) { /* no size constraints were placed, so use malloc elem len */ requested_len = 0; - mz_addr = malloc_heap_alloc_biggest(NULL, socket_id, flags, - align, contig); + mz_addr = malloc_heap_alloc_biggest(socket_id, flags, align, contig); } else { if (len == 0) requested_len = bound; /* allocate memory on heap */ - mz_addr = malloc_heap_alloc(NULL, requested_len, socket_id, - flags, align, bound, contig); + mz_addr = malloc_heap_alloc(requested_len, socket_id, flags, align, bound, contig); } if (mz_addr == NULL) { rte_errno = ENOMEM; diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c index 5ff27548ff..058aaf4209 100644 --- a/lib/eal/common/malloc_heap.c +++ b/lib/eal/common/malloc_heap.c @@ -229,8 +229,8 @@ find_biggest_element(struct malloc_heap *heap, size_t *size, * the new element after releasing the lock. */ static void * -heap_alloc(struct malloc_heap *heap, const char *type __rte_unused, size_t size, - unsigned int flags, size_t align, size_t bound, bool contig) +heap_alloc(struct malloc_heap *heap, size_t size, unsigned int flags, + size_t align, size_t bound, bool contig) { struct malloc_elem *elem; size_t user_size = size; @@ -255,8 +255,7 @@ heap_alloc(struct malloc_heap *heap, const char *type __rte_unused, size_t size, } static void * -heap_alloc_biggest(struct malloc_heap *heap, const char *type __rte_unused, - unsigned int flags, size_t align, bool contig) +heap_alloc_biggest(struct malloc_heap *heap, unsigned int flags, size_t align, bool contig) { struct malloc_elem *elem; size_t size; @@ -640,8 +639,7 @@ alloc_more_mem_on_socket(struct malloc_heap *heap, size_t size, int socket, /* this will try lower page sizes first */ static void * -malloc_heap_alloc_on_heap_id(const char *type, size_t size, - unsigned int heap_id, unsigned int flags, size_t align, +malloc_heap_alloc_on_heap_id(size_t size, unsigned int heap_id, unsigned int flags, size_t align, size_t bound, bool contig) { struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config; @@ -658,7 +656,7 @@ malloc_heap_alloc_on_heap_id(const char *type, size_t size, /* for legacy mode, try once and with all flags */ if (internal_conf->legacy_mem) { - ret = heap_alloc(heap, type, size, flags, align, bound, contig); + ret = heap_alloc(heap, size, flags, align, bound, contig); goto alloc_unlock; } @@ -679,7 +677,7 @@ malloc_heap_alloc_on_heap_id(const char *type, size_t size, if (socket_id < 0) size_flags |= RTE_MEMZONE_SIZE_HINT_ONLY; - ret = heap_alloc(heap, type, size, size_flags, align, bound, contig); + ret = heap_alloc(heap, size, size_flags, align, bound, contig); if (ret != NULL) goto alloc_unlock; @@ -689,7 +687,7 @@ malloc_heap_alloc_on_heap_id(const char *type, size_t size, if (!alloc_more_mem_on_socket(heap, size, socket_id, flags, align, bound, contig)) { - ret = heap_alloc(heap, type, size, flags, align, bound, contig); + ret = heap_alloc(heap, size, flags, align, bound, contig); /* this should have succeeded */ if (ret == NULL) @@ -730,8 +728,8 @@ malloc_get_numa_socket(void) } void * -malloc_heap_alloc(const char *type, size_t size, int socket_arg, - unsigned int flags, size_t align, size_t bound, bool contig) +malloc_heap_alloc(size_t size, int socket_arg, unsigned int flags, + size_t align, size_t bound, bool contig) { int socket, heap_id, i; void *ret; @@ -754,8 +752,7 @@ malloc_heap_alloc(const char *type, size_t size, int socket_arg, if (heap_id < 0) return NULL; - ret = malloc_heap_alloc_on_heap_id(type, size, heap_id, flags, align, - bound, contig); + ret = malloc_heap_alloc_on_heap_id(size, heap_id, flags, align, bound, contig); if (ret != NULL || socket_arg != SOCKET_ID_ANY) return ret; @@ -765,8 +762,7 @@ malloc_heap_alloc(const char *type, size_t size, int socket_arg, for (i = 0; i < (int) rte_socket_count(); i++) { if (i == heap_id) continue; - ret = malloc_heap_alloc_on_heap_id(type, size, i, flags, align, - bound, contig); + ret = malloc_heap_alloc_on_heap_id(size, i, flags, align, bound, contig); if (ret != NULL) return ret; } @@ -774,7 +770,7 @@ malloc_heap_alloc(const char *type, size_t size, int socket_arg, } static void * -heap_alloc_biggest_on_heap_id(const char *type, unsigned int heap_id, +heap_alloc_biggest_on_heap_id(unsigned int heap_id, unsigned int flags, size_t align, bool contig) { struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config; @@ -785,7 +781,7 @@ heap_alloc_biggest_on_heap_id(const char *type, unsigned int heap_id, align = align == 0 ? 1 : align; - ret = heap_alloc_biggest(heap, type, flags, align, contig); + ret = heap_alloc_biggest(heap, flags, align, contig); rte_spinlock_unlock(&(heap->lock)); @@ -793,8 +789,7 @@ heap_alloc_biggest_on_heap_id(const char *type, unsigned int heap_id, } void * -malloc_heap_alloc_biggest(const char *type, int socket_arg, unsigned int flags, - size_t align, bool contig) +malloc_heap_alloc_biggest(int socket_arg, unsigned int flags, size_t align, bool contig) { int socket, i, cur_socket, heap_id; void *ret; @@ -817,8 +812,7 @@ malloc_heap_alloc_biggest(const char *type, int socket_arg, unsigned int flags, if (heap_id < 0) return NULL; - ret = heap_alloc_biggest_on_heap_id(type, heap_id, flags, align, - contig); + ret = heap_alloc_biggest_on_heap_id(heap_id, flags, align, contig); if (ret != NULL || socket_arg != SOCKET_ID_ANY) return ret; @@ -827,8 +821,7 @@ malloc_heap_alloc_biggest(const char *type, int socket_arg, unsigned int flags, cur_socket = rte_socket_id_by_idx(i); if (cur_socket == socket) continue; - ret = heap_alloc_biggest_on_heap_id(type, i, flags, align, - contig); + ret = heap_alloc_biggest_on_heap_id(i, flags, align, contig); if (ret != NULL) return ret; } diff --git a/lib/eal/common/malloc_heap.h b/lib/eal/common/malloc_heap.h index 0c49588005..dfc56d4ae3 100644 --- a/lib/eal/common/malloc_heap.h +++ b/lib/eal/common/malloc_heap.h @@ -34,12 +34,11 @@ struct __rte_cache_aligned malloc_heap { }; void * -malloc_heap_alloc(const char *type, size_t size, int socket, unsigned int flags, - size_t align, size_t bound, bool contig); +malloc_heap_alloc(size_t size, int socket, unsigned int flags, size_t align, + size_t bound, bool contig); void * -malloc_heap_alloc_biggest(const char *type, int socket, unsigned int flags, - size_t align, bool contig); +malloc_heap_alloc_biggest(int socket, unsigned int flags, size_t align, bool contig); int malloc_heap_create(struct malloc_heap *heap, const char *heap_name); diff --git a/lib/eal/common/rte_malloc.c b/lib/eal/common/rte_malloc.c index 6d3c301a23..3eed4d4be6 100644 --- a/lib/eal/common/rte_malloc.c +++ b/lib/eal/common/rte_malloc.c @@ -69,7 +69,7 @@ malloc_socket(const char *type, size_t size, unsigned int align, !rte_eal_has_hugepages()) socket_arg = SOCKET_ID_ANY; - ptr = malloc_heap_alloc(type, size, socket_arg, 0, + ptr = malloc_heap_alloc(size, socket_arg, 0, align == 0 ? 1 : align, 0, false); if (trace_ena) -- 2.43.0