From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anatoly Burakov Subject: [PATCH v2 07/41] eal: make malloc free list remove public Date: Wed, 7 Mar 2018 16:56:35 +0000 Message-ID: <611bd32518e821c857c1878db40b2e60e10368d2.1520428025.git.anatoly.burakov@intel.com> References: Cc: keith.wiles@intel.com, jianfeng.tan@intel.com, andras.kovacs@ericsson.com, laszlo.vadkeri@ericsson.com, benjamin.walker@intel.com, bruce.richardson@intel.com, thomas@monjalon.net, konstantin.ananyev@intel.com, kuralamudhan.ramakrishnan@intel.com, louise.m.daly@intel.com, nelio.laranjeiro@6wind.com, yskoh@mellanox.com, pepperjo@japf.ch, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, olivier.matz@6wind.com To: dev@dpdk.org Return-path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 941CC5F2A for ; Wed, 7 Mar 2018 17:57:15 +0100 (CET) In-Reply-To: In-Reply-To: References: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Signed-off-by: Anatoly Burakov --- lib/librte_eal/common/malloc_elem.c | 12 ++++++------ lib/librte_eal/common/malloc_elem.h | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/librte_eal/common/malloc_elem.c b/lib/librte_eal/common/malloc_elem.c index 2291ee1..008f5a3 100644 --- a/lib/librte_eal/common/malloc_elem.c +++ b/lib/librte_eal/common/malloc_elem.c @@ -245,8 +245,8 @@ malloc_elem_free_list_insert(struct malloc_elem *elem) /* * Remove the specified element from its heap's free list. */ -static void -elem_free_list_remove(struct malloc_elem *elem) +void +malloc_elem_free_list_remove(struct malloc_elem *elem) { LIST_REMOVE(elem, free_list); } @@ -266,7 +266,7 @@ malloc_elem_alloc(struct malloc_elem *elem, size_t size, unsigned align, const size_t trailer_size = elem->size - old_elem_size - size - MALLOC_ELEM_OVERHEAD; - elem_free_list_remove(elem); + malloc_elem_free_list_remove(elem); if (trailer_size > MALLOC_ELEM_OVERHEAD + MIN_DATA_SIZE) { /* split it, too much free space after elem */ @@ -340,7 +340,7 @@ malloc_elem_join_adjacent_free(struct malloc_elem *elem) erase = RTE_PTR_SUB(elem->next, MALLOC_ELEM_TRAILER_LEN); /* remove from free list, join to this one */ - elem_free_list_remove(elem->next); + malloc_elem_free_list_remove(elem->next); join_elem(elem, elem->next); /* erase header and trailer */ @@ -360,7 +360,7 @@ malloc_elem_join_adjacent_free(struct malloc_elem *elem) erase = RTE_PTR_SUB(elem, MALLOC_ELEM_TRAILER_LEN); /* remove from free list, join to this one */ - elem_free_list_remove(elem->prev); + malloc_elem_free_list_remove(elem->prev); new_elem = elem->prev; join_elem(new_elem, elem); @@ -423,7 +423,7 @@ malloc_elem_resize(struct malloc_elem *elem, size_t size) /* we now know the element fits, so remove from free list, * join the two */ - elem_free_list_remove(elem->next); + malloc_elem_free_list_remove(elem->next); join_elem(elem, elem->next); if (elem->size - new_size >= MIN_DATA_SIZE + MALLOC_ELEM_OVERHEAD) { diff --git a/lib/librte_eal/common/malloc_elem.h b/lib/librte_eal/common/malloc_elem.h index 99921d2..46e2383 100644 --- a/lib/librte_eal/common/malloc_elem.h +++ b/lib/librte_eal/common/malloc_elem.h @@ -151,6 +151,9 @@ malloc_elem_join_adjacent_free(struct malloc_elem *elem); int malloc_elem_resize(struct malloc_elem *elem, size_t size); +void +malloc_elem_free_list_remove(struct malloc_elem *elem); + /* * dump contents of malloc elem to a file. */ -- 2.7.4