DPDK patches and discussions
 help / color / mirror / Atom feed
From: Olivier MATZ <olivier.matz@6wind.com>
To: "Gonzalez Monroy, Sergio" <sergio.gonzalez.monroy@intel.com>,
	 "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] Regarding rte_memzone_reserve with len =0
Date: Tue, 12 May 2015 16:48:23 +0200	[thread overview]
Message-ID: <555212B7.6030604@6wind.com> (raw)
In-Reply-To: <554A3D0A.6070605@intel.com>

Hi Sergio,

On 05/06/2015 06:10 PM, Gonzalez Monroy, Sergio wrote:
> Hi,
>
> I was wondering about the use case of rte_memzone_reserve_xxxx APIs with
> len=0.
>
>  From the docs (http://dpdk.org/doc/api/rte__memzone_8h.html):
> len          The size of the memory to be reserved. If it is 0, the
> biggest contiguous zone will be reserved.
>
> What are the use cases?
> When would you want a memzone of undetermined size?
>
> Any thoughts appreciated.

As the application does not have access to the lengths of memory
segments, probably the initial idea is when an application wants
to allocate more memory that the biggest segment.

Example, the application wants to allocate 1G (even fragmented):

- the easy case is when it can be done in one call to
   rte_memzone_reserve(1G)

- else, the application can iterate like in this sample:

      remain = 1 * 1024 * 1024 * 1024;
      while (remain > 0) {
          mz = rte_memzone_reserve(remain);
          if (mz != NULL)
             return 0;
          mz = rte_memzone_reserve(remain);
          if (mz == NULL)
             return -1;
          remain -= mz->len;
      }

Regards,
Olivier

  reply	other threads:[~2015-05-12 14:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06 16:10 Gonzalez Monroy, Sergio
2015-05-12 14:48 ` Olivier MATZ [this message]
2015-05-13 10:14   ` Gonzalez Monroy, Sergio
2015-05-13 11:08     ` Olivier MATZ

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=555212B7.6030604@6wind.com \
    --to=olivier.matz@6wind.com \
    --cc=dev@dpdk.org \
    --cc=sergio.gonzalez.monroy@intel.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).