X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Feal%2Fcommon%2Fmalloc_heap.c;fp=lib%2Feal%2Fcommon%2Fmalloc_heap.c;h=054d92bc7d21b38a30a3e64819b381777ac97169;hb=b7cdfefe409609bf37484934699a10a14bb9f9a3;hp=ee400f38ec7fb69639530f93b1c36a69ceec4320;hpb=3a05b98dd6d72851d4a8819dbffcd52aaf98a2b1;p=dpdk.git diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c index ee400f38ec..054d92bc7d 100644 --- a/lib/eal/common/malloc_heap.c +++ b/lib/eal/common/malloc_heap.c @@ -694,6 +694,24 @@ alloc_unlock: return ret; } +static unsigned +malloc_get_numa_socket(void) +{ + const struct internal_config *internal_conf = + eal_get_internal_configuration(); + unsigned socket_id = rte_socket_id(); + + if (socket_id != (unsigned)SOCKET_ID_ANY) + return socket_id; + + /* return first id where memory is available, otherwise 0 */ + for (socket_id = 0; socket_id < RTE_MAX_NUMA_NODES; ++socket_id) + if (internal_conf->socket_mem[socket_id] != 0) + return socket_id; + + return 0; +} + void * malloc_heap_alloc(const char *type, size_t size, int socket_arg, unsigned int flags, size_t align, size_t bound, bool contig)