From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 65C8C11DE for ; Thu, 5 Oct 2017 11:02:24 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP; 05 Oct 2017 02:02:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,480,1500966000"; d="scan'208";a="1202495380" Received: from unknown (HELO [10.237.210.16]) ([10.237.210.16]) by fmsmga001.fm.intel.com with ESMTP; 05 Oct 2017 02:02:21 -0700 To: Venumadhav Josyula , "dev@dpdk.org" References: From: "Burakov, Anatoly" Message-ID: <39619f84-90a3-6fa6-8df3-6b973b526360@intel.com> Date: Thu, 5 Oct 2017 10:02:21 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] API in dpdk to get total free physical memory 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: Thu, 05 Oct 2017 09:02:25 -0000 On 05-Oct-17 6:56 AM, Venumadhav Josyula wrote: > Hi All, > > Like 'rte_eal_get_physmem_size' api to the total size of the physical memory. Is there an API to get to get total free memory physical memory available ? > > We want such API we are planning to implement such API for the same > > /* get the total size of memory */ > uint64_t > rte_eal_get_physmem_free(int socket_id) > { > const struct rte_mem_config *mcfg; > unsigned i = 0; > uint64_t total_len = 0; > > /* get pointer to global configuration */ > mcfg = rte_eal_get_configuration()->mem_config; > > for (i=0; i if (mcfg->free_memseg[i].addr == NULL) > break; > > if (mcfg->free_memseg[i].len == 0) > continue; > > /* bad socket ID */ > if (socket_id != SOCKET_ID_ANY && > mcfg->free_memseg[i].socket_id != SOCKET_ID_ANY && > socket_id != mcfg->free_memseg[i].socket_id) > continue; > > total_len += mcfg->free_memseg[i].len; > } > > return total_len; > } > > Thanks, > Regards > Venu > Hi Venu, I don't think there is such an API, so you're welcome to submit a patch. -- Thanks, Anatoly