DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: Venumadhav Josyula <vjosyula@parallelwireless.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] API in dpdk to get total free physical memory
Date: Thu, 5 Oct 2017 10:02:21 +0100	[thread overview]
Message-ID: <39619f84-90a3-6fa6-8df3-6b973b526360@intel.com> (raw)
In-Reply-To: <DM5PR19MB0939B3E0A850162BF173CFBCBF700@DM5PR19MB0939.namprd19.prod.outlook.com>

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<RTE_MAX_MEMSEG; 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

  reply	other threads:[~2017-10-05  9:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-05  5:56 Venumadhav Josyula
2017-10-05  9:02 ` Burakov, Anatoly [this message]
2018-03-08 21:36 [dpdk-dev] Api " Venumadhav Josyula
2018-03-09  9:05 ` Burakov, Anatoly
2018-03-09  9:59   ` Venumadhav Josyula
2018-03-09 10:56     ` Burakov, Anatoly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=39619f84-90a3-6fa6-8df3-6b973b526360@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=vjosyula@parallelwireless.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).