From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier MATZ Subject: Re: Regarding rte_memzone_reserve with len =0 Date: Wed, 13 May 2015 13:08:43 +0200 Message-ID: <555330BB.4070908@6wind.com> References: <554A3D0A.6070605@intel.com> <555212B7.6030604@6wind.com> <55532400.2020503@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: "dev@dpdk.org" To: "Gonzalez Monroy, Sergio" Return-path: Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by dpdk.org (Postfix) with ESMTP id 7883A5A30 for ; Wed, 13 May 2015 13:08:48 +0200 (CEST) Received: by wicnf17 with SMTP id nf17so51027549wic.1 for ; Wed, 13 May 2015 04:08:48 -0700 (PDT) In-Reply-To: <55532400.2020503@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "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