DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Gonzalez Monroy, Sergio" <sergio.gonzalez.monroy@intel.com>
To: Olivier MATZ <olivier.matz@6wind.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] Regarding rte_memzone_reserve with len =0
Date: Wed, 13 May 2015 11:14:24 +0100	[thread overview]
Message-ID: <55532400.2020503@intel.com> (raw)
In-Reply-To: <555212B7.6030604@6wind.com>

On 12/05/2015 15:48, Olivier MATZ wrote:
> 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);
You meant rte_memzone_reserve(0) here, right?
> if (mz == NULL)
>             return -1;
>          remain -= mz->len;
>      }
>
Thanks Olivier, that makes sense.

Sergio
> Regards,
> Olivier
>

  reply	other threads:[~2015-05-13 10:14 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
2015-05-13 10:14   ` Gonzalez Monroy, Sergio [this message]
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=55532400.2020503@intel.com \
    --to=sergio.gonzalez.monroy@intel.com \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.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).