diff mbox

[dpdk-dev,1/2] mempool: fix comments for mempool create functions

Message ID 20160920161708.9707-1-ferruh.yigit@intel.com (mailing list archive)
State Changes Requested, archived
Delegated to: Thomas Monjalon
Headers show

Commit Message

Ferruh Yigit Sept. 20, 2016, 4:17 p.m. UTC
Fixes: 85226f9c526b ("mempool: introduce a function to create an empty pool")
Fixes: d1d914ebbc25 ("mempool: allocate in several memory chunks by default")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 lib/librte_mempool/rte_mempool.c | 4 +---
 lib/librte_mempool/rte_mempool.h | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

Comments

Olivier Matz Sept. 21, 2016, 3:04 p.m. UTC | #1
Hi Ferruh,

Thanks for checking the API documentation.
Please see few comments below.

On 09/20/2016 06:17 PM, Ferruh Yigit wrote:
> Fixes: 85226f9c526b ("mempool: introduce a function to create an empty pool")
> Fixes: d1d914ebbc25 ("mempool: allocate in several memory chunks by default")
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
>  lib/librte_mempool/rte_mempool.c | 4 +---
>  lib/librte_mempool/rte_mempool.h | 4 +---
>  2 files changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
> index df8b68c..e96d14f 100644
> --- a/lib/librte_mempool/rte_mempool.c
> +++ b/lib/librte_mempool/rte_mempool.c
> @@ -908,9 +908,7 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size,
>  /*
>   * Create the mempool over already allocated chunk of memory.
>   * That external memory buffer can consists of physically disjoint pages.
> - * Setting vaddr to NULL, makes mempool to fallback to original behaviour
> - * and allocate space for mempool and it's elements as one big chunk of
> - * physically continuos memory.
> + * Setting vaddr to NULL, makes mempool to fallback to original behaviour.

I would replace "original behaviour" by "rte_mempool_create() behaviour".

>   */
>  struct rte_mempool *
>  rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,
> diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
> index 0243f9e..6fc331a 100644
> --- a/lib/librte_mempool/rte_mempool.h
> +++ b/lib/librte_mempool/rte_mempool.h
> @@ -591,8 +591,6 @@ typedef void (rte_mempool_ctor_t)(struct rte_mempool *, void *);
>   *
>   * This function uses ``memzone_reserve()`` to allocate memory. The
>   * pool contains n elements of elt_size. Its size is set to n.
> - * All elements of the mempool are allocated together with the mempool header,
> - * in one physically continuous chunk of memory.

While there, maybe we could replace ``memzone_reserve()`` by
``rte_memzone_reserve()``.

>   *
>   * @param name
>   *   The name of the mempool.
> @@ -748,7 +746,7 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,
>   *
>   * The mempool is allocated and initialized, but it is not populated: no
>   * memory is allocated for the mempool elements. The user has to call
> - * rte_mempool_populate_*() or to add memory chunks to the pool. Once
> + * rte_mempool_populate_*() to add memory chunks to the pool. Once
>   * populated, the user may also want to initialize each object with
>   * rte_mempool_obj_iter().
>   *
>
Ferruh Yigit Sept. 21, 2016, 4:16 p.m. UTC | #2
On 9/21/2016 4:04 PM, Olivier Matz wrote:
> Hi Ferruh,
> 
> Thanks for checking the API documentation.
> Please see few comments below.
> 
> On 09/20/2016 06:17 PM, Ferruh Yigit wrote:
>> Fixes: 85226f9c526b ("mempool: introduce a function to create an empty pool")
>> Fixes: d1d914ebbc25 ("mempool: allocate in several memory chunks by default")
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>> ---
>>  lib/librte_mempool/rte_mempool.c | 4 +---
>>  lib/librte_mempool/rte_mempool.h | 4 +---
>>  2 files changed, 2 insertions(+), 6 deletions(-)
>>
>> diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
>> index df8b68c..e96d14f 100644
>> --- a/lib/librte_mempool/rte_mempool.c
>> +++ b/lib/librte_mempool/rte_mempool.c
>> @@ -908,9 +908,7 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size,
>>  /*
>>   * Create the mempool over already allocated chunk of memory.
>>   * That external memory buffer can consists of physically disjoint pages.
>> - * Setting vaddr to NULL, makes mempool to fallback to original behaviour
>> - * and allocate space for mempool and it's elements as one big chunk of
>> - * physically continuos memory.
>> + * Setting vaddr to NULL, makes mempool to fallback to original behaviour.
> 
> I would replace "original behaviour" by "rte_mempool_create() behaviour".
> 
>>   */
>>  struct rte_mempool *
>>  rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,
>> diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
>> index 0243f9e..6fc331a 100644
>> --- a/lib/librte_mempool/rte_mempool.h
>> +++ b/lib/librte_mempool/rte_mempool.h
>> @@ -591,8 +591,6 @@ typedef void (rte_mempool_ctor_t)(struct rte_mempool *, void *);
>>   *
>>   * This function uses ``memzone_reserve()`` to allocate memory. The
>>   * pool contains n elements of elt_size. Its size is set to n.
>> - * All elements of the mempool are allocated together with the mempool header,
>> - * in one physically continuous chunk of memory.
> 
> While there, maybe we could replace ``memzone_reserve()`` by
> ``rte_memzone_reserve()``.
> 
>>   *
>>   * @param name
>>   *   The name of the mempool.
>> @@ -748,7 +746,7 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,
>>   *
>>   * The mempool is allocated and initialized, but it is not populated: no
>>   * memory is allocated for the mempool elements. The user has to call
>> - * rte_mempool_populate_*() or to add memory chunks to the pool. Once
>> + * rte_mempool_populate_*() to add memory chunks to the pool. Once
>>   * populated, the user may also want to initialize each object with
>>   * rte_mempool_obj_iter().
>>   *
>>


Thanks for the comments, I will send a new version of the patch with
suggested fixes.

Thanks,
ferruh
diff mbox

Patch

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index df8b68c..e96d14f 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -908,9 +908,7 @@  rte_mempool_create(const char *name, unsigned n, unsigned elt_size,
 /*
  * Create the mempool over already allocated chunk of memory.
  * That external memory buffer can consists of physically disjoint pages.
- * Setting vaddr to NULL, makes mempool to fallback to original behaviour
- * and allocate space for mempool and it's elements as one big chunk of
- * physically continuos memory.
+ * Setting vaddr to NULL, makes mempool to fallback to original behaviour.
  */
 struct rte_mempool *
 rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,
diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index 0243f9e..6fc331a 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -591,8 +591,6 @@  typedef void (rte_mempool_ctor_t)(struct rte_mempool *, void *);
  *
  * This function uses ``memzone_reserve()`` to allocate memory. The
  * pool contains n elements of elt_size. Its size is set to n.
- * All elements of the mempool are allocated together with the mempool header,
- * in one physically continuous chunk of memory.
  *
  * @param name
  *   The name of the mempool.
@@ -748,7 +746,7 @@  rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,
  *
  * The mempool is allocated and initialized, but it is not populated: no
  * memory is allocated for the mempool elements. The user has to call
- * rte_mempool_populate_*() or to add memory chunks to the pool. Once
+ * rte_mempool_populate_*() to add memory chunks to the pool. Once
  * populated, the user may also want to initialize each object with
  * rte_mempool_obj_iter().
  *