On 13-Jul-18 5:05 PM, Alejandro Lucero wrote:
- /* get pointer to global configuration */ - mcfg = rte_eal_get_configuration()->mem_config; - - for (i = 0; i < RTE_MAX_NUMA_NODES; i++) { - if ((socket != SOCKET_ID_ANY) && (socket != i)) + for (idx = 0; idx < rte_socket_count(); idx++) { + int cur_socket = rte_socket_id_by_idx(idx); + if ((socket != SOCKET_ID_ANY) && (socket != cur_socket)) continue;- malloc_heap_get_stats(&mcfg->malloc_heaps[i], &stats); - if (stats.greatest_free_size > len) { - len = stats.greatest_free_size; - *s = i; + size_t cur_len = heap_max_free_elem(idx, align); + if (cur_len > len) { + len = cur_len; + *s = cur_socket; } } - if (len < MALLOC_ELEM_OVERHEAD + align) - return 0; - - return len - MALLOC_ELEM_OVERHEAD - align; + return len;Is it worth to set *s to some safe value if no space at all?
No, the value of *s is set externally anyway, and is not used of return value is 0.
Thanks for other comments, will fix when the next iteration comes. -- Thanks, Anatoly

