You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
lib: vregion: lazy interim heap creation from remaining lifetime space
Refactor the vregion memory layout to use a single contiguous buffer
instead of two separately page-aligned partitions. The vregion
lifetime allocations start at the base and growing upward. The interim
k_heap is created lazily when vregion_set_interim() is called
for whatever space remains after lifetime allocations.
This eliminates the rigid partition boundary that previously wasted
memory when lifetime usage was smaller or larger than pre-configured.
The interim heap creation is deferred until actually needed, at which
point the lifetime region is sealed and any further allocation
requests are redirected to the interim.
The vregion tracks internal allocation mode (lifetime or interim).
All allocations start in lifetime mode. The vregion_set_interim()
function switches to interim mode. The enum vregion_mem_type parameter
has been removed from the vregion_alloc*() API since the mode is now
internal state.
vregion_set_interim() is called in pipeline_comp_complete() in case
the component's processing domain is Data Processing. The DP
components are so far the only place where vregions are used at the
moment.
Add a guard to skip k_heap_init() in interim_heap_init() if the
remaining interim size is too small (< 1024 bytes), which would
otherwise trigger an assert failure in sys_heap_init(). Mark the
vregion type to VREGION_MEM_TYPE_INVALID if that happens.
Key changes:
- vregion_create(): Takes single memsize argument instead of separate
lifetime_size and interim_size
- New vregion_set_interim(): Switches allocation mode from lifetime to
interim, warns on repeated calls
- vregion_alloc*(): No longer take enum vregion_mem_type parameter,
use internal state instead
- New interim_heap_init(): Called lazily, page-aligns interim start,
logs lifetime used and interim available at INFO level
- vregion_free(): Guards interim pointer range
- pipeline_comp_completee(): Calls vregion_set_interim() to switch mode
Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
0 commit comments