Hi Dmitry,

On 2022/10/11 23:58, Dmitry Kozlyuk wrote:
> 2022-10-11 12:17 (UTC+0000), Chengwen Feng:
>> This patch adds a memarea backup mechanism, where an allocation request
>> which cannot be met by the current memarea is deferred to its backup
>> memarea.
> 
> This is a controversial feature.
> 
> 1. It violates memarea property of freeing all allocated objects
>    at once when the memarea itself is destroyed. Objects allocated
>    in the backup memarea through the destroyed one will remain.
> 
> 2. If there was an API to check that the object belongs to a memarea
>    (the check from rte_memarea_update_refcnt() in this patch),
>    it would be trivial to implement this feature on top of memarea API.

This patch add 'struct memarea *owner' in each object's meta data, and it was
used to free which allocated from backup memarea. So this problem will not 
exist.

> 
> Nit: "Deferred" is about time -> "forwarded", "delegated", or "handled over".

ok

> 
> A general note about this series.
> IMO, libraries should have limited scope and allow composition
> rather than accumulate features and control their use via options.
> The core idea of memarea is an allocator within a memory region,
> a fast one and with low overhead, usable to free all objects at once.
> 
> This is orthogonal to the question from where the memory comes from.
> HEAP and LIBC sources could be built on top of USER source,
> which means that the concept of source is less relevant.
> Backup mechanism could instead be a way to add memory to the area,
> in which case HEAP and LIBC memarea would also be expandable.
> Memarea API could be defined as a structure with callbacks,
> and different types of memarea could be combined,
> for example, interlocked memarea on top of expandable memarea on top of
> memarea with a particular memory management algorithm.
> 
> I'm not saying we should immediately build all this complexity.
> On the contrary, I would merge the basic things first,
> then try to _stack_ new features on top,
> then look if interfaces emerge that can be used for composition.

Agree, I will drop this feature in next version.

> .
> 

Reply via email to