From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Burakov, Anatoly" Subject: Re: [RFC 03/11] malloc: index heaps using heap ID rather than NUMA node Date: Fri, 13 Jul 2018 17:08:28 +0100 Message-ID: <7e5fa73f-7006-44d5-3e31-40cb7a948f9c@intel.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: dev , Thomas Monjalon , srinath.mannam@broadcom.com, scott.branden@broadcom.com, Ajit Khaparde To: Alejandro Lucero Return-path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 6FFAB10B7 for ; Fri, 13 Jul 2018 18:08:50 +0200 (CEST) In-Reply-To: Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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