[PATCH v16 1/6] memarea: introduce memarea library

Burakov, Anatoly anatoly.burakov at intel.com
Mon Jul 17 15:19:38 CEST 2023


On 7/10/2023 7:49 AM, Chengwen Feng wrote:
> The memarea library is an allocator of variable-size object which based
> on a memory region.
> 
> This patch provides rte_memarea_create() and rte_memarea_destroy() API.
> 
> Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
> Reviewed-by: Dongdong Liu <liudongdong3 at huawei.com>
> Acked-by: Morten Brørup <mb at smartsharesystems.com>
> ---

Hi,

Couple of nitpicks below.

> +	/** The obj_list is an address ascending ordered linked list:
> +	 *             ----------------------               --------------
> +	 *             |      object-1      |               |  object-1  |
> +	 * obj_list -> |~~~~~~~~~~~~~~~~~~~~|  data-region  |~~~~~~~~~~~~|
> +	 *        ---> | tailq | hdr-cookie |               | tlr-cookie |
> +	 *        |    ----------------------               --------------
> +	 *        |
> +	 *        |    ----------------------               --------------
> +	 *        |    |      object-2      |               |  object-2  |
> +	 *        ---> |~~~~~~~~~~~~~~~~~~~~|  data-region  |~~~~~~~~~~~~|
> +	 *        ---> | tailq | hdr-cookie |               | tlr-cookie |
> +	 *        |     ----------------------               --------------
> +	 *        ...
> +	 *        ...  more objects.
> +	 *        ...
> +	 *        |    ----------------------
> +	 *        |    |    object-guard    |
> +	 *        ---> |~~~~~~~~~~~~~~~~~~~~|
> +	 *             | tailq | hdr-cookie |
> +	 *             ----------------------
> +	 * Note: the last object is the guard object, which has no data-region
> +	 *       and no tailer cookie.

Trailer* cookie

> +
> +/**
> + * Set cookie.
> + *
> + * @param status
> + *   - 0: object is set to be available, but don't set tailer cookie.
> + *   - 1: object is set to be allocated, but don't set tailer cookie.
> + *   - 2: object is new split, the header cookie will set to be available,
> + *        the tailer cookie of the previous object will be set.
> + *   - 3: object is new split, the header cookie will set to be allocated,
> + *        the tailer cookie of the previous object will be set.
> + *   - 4: object is to be merged, it will no longer exist. the header cookie
> + *        is cleared and the tailer cookie of the previous object is cleared.

I feel like it would've been better if all of these constants are 
defined, so that it wouldn't be '0' but rather STATUS_AVAILABLE (or 
similar).

Otherwise, great bit of rework, so thanks for the effort!

Acked-by: Anatoly Burakov <anatoly.burakov at intel.com>

-- 
Thanks,
Anatoly



More information about the dev mailing list