From mboxrd@z Thu Jan 1 00:00:00 1970 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) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jul 2018 09:08:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,348,1526367600"; d="scan'208";a="72118738" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.252.0.191]) ([10.252.0.191]) by fmsmga001.fm.intel.com with ESMTP; 13 Jul 2018 09:08:29 -0700 To: Alejandro Lucero Cc: dev , Thomas Monjalon , srinath.mannam@broadcom.com, scott.branden@broadcom.com, Ajit Khaparde References: From: "Burakov, Anatoly" Message-ID: <7e5fa73f-7006-44d5-3e31-40cb7a948f9c@intel.com> Date: Fri, 13 Jul 2018 17:08:28 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [RFC 03/11] malloc: index heaps using heap ID rather than NUMA node X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 16:08:51 -0000 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