DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] Regarding rte_memzone_reserve with len =0
@ 2015-05-06 16:10 Gonzalez Monroy, Sergio
  2015-05-12 14:48 ` Olivier MATZ
  0 siblings, 1 reply; 4+ messages in thread
From: Gonzalez Monroy, Sergio @ 2015-05-06 16:10 UTC (permalink / raw)
  To: dev

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.

Sergio

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] Regarding rte_memzone_reserve with len =0
  2015-05-06 16:10 [dpdk-dev] Regarding rte_memzone_reserve with len =0 Gonzalez Monroy, Sergio
@ 2015-05-12 14:48 ` Olivier MATZ
  2015-05-13 10:14   ` Gonzalez Monroy, Sergio
  0 siblings, 1 reply; 4+ messages in thread
From: Olivier MATZ @ 2015-05-12 14:48 UTC (permalink / raw)
  To: Gonzalez Monroy, Sergio, dev

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] Regarding rte_memzone_reserve with len =0
  2015-05-12 14:48 ` Olivier MATZ
@ 2015-05-13 10:14   ` Gonzalez Monroy, Sergio
  2015-05-13 11:08     ` Olivier MATZ
  0 siblings, 1 reply; 4+ messages in thread
From: Gonzalez Monroy, Sergio @ 2015-05-13 10:14 UTC (permalink / raw)
  To: Olivier MATZ; +Cc: dev

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
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] Regarding rte_memzone_reserve with len =0
  2015-05-13 10:14   ` Gonzalez Monroy, Sergio
@ 2015-05-13 11:08     ` Olivier MATZ
  0 siblings, 0 replies; 4+ messages in thread
From: Olivier MATZ @ 2015-05-13 11:08 UTC (permalink / raw)
  To: Gonzalez Monroy, Sergio; +Cc: dev

On 05/13/2015 12:14 PM, Gonzalez Monroy, Sergio wrote:
> 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?

yes, sorry for the typo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-13 11:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-06 16:10 [dpdk-dev] Regarding rte_memzone_reserve with len =0 Gonzalez Monroy, Sergio
2015-05-12 14:48 ` Olivier MATZ
2015-05-13 10:14   ` Gonzalez Monroy, Sergio
2015-05-13 11:08     ` Olivier MATZ

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).