X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_eal%2Fcommon%2Fmalloc_heap.c;h=4c3632d02bdf9a310b4c4bbb9cddfd375c967212;hb=476c847ab6755d233dd786e8b87970c7105fbce2;hp=c6a6d4f6bdce1aafb2fabea6c66b6661fe3ad918;hpb=cc8035322384b2454b596ee7e557cae3250f20f1;p=dpdk.git diff --git a/lib/librte_eal/common/malloc_heap.c b/lib/librte_eal/common/malloc_heap.c index c6a6d4f6bd..4c3632d02b 100644 --- a/lib/librte_eal/common/malloc_heap.c +++ b/lib/librte_eal/common/malloc_heap.c @@ -94,7 +94,7 @@ malloc_heap_add_memory(struct malloc_heap *heap, struct rte_memseg_list *msl, { struct malloc_elem *elem = start; - malloc_elem_init(elem, heap, msl, len); + malloc_elem_init(elem, heap, msl, len, elem, len); malloc_elem_insert(elem); @@ -857,6 +857,13 @@ malloc_heap_free(struct malloc_elem *elem) if (elem->size < page_sz) goto free_unlock; + /* if user requested to match allocations, the sizes must match - if not, + * we will defer freeing these hugepages until the entire original allocation + * can be freed + */ + if (internal_config.match_allocations && elem->size != elem->orig_size) + goto free_unlock; + /* probably, but let's make sure, as we may not be using up full page */ start = elem; len = elem->size; @@ -1259,6 +1266,10 @@ rte_eal_malloc_heap_init(void) struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config; unsigned int i; + if (internal_config.match_allocations) { + RTE_LOG(DEBUG, EAL, "Hugepages will be freed exactly as allocated.\n"); + } + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { /* assign min socket ID to external heaps */ mcfg->next_socket_id = EXTERNAL_HEAP_MIN_SOCKET_ID;