mm/mempool: The wait variable of the memory pool is controlled by macros

The wait variable of the memory pool is modified to be controlled by macros, facilitating dynamic adjustment of its value via configuration macros.

Signed-off-by: zhanxiaoqi <zhanxiaoqi@bytedance.com>
This commit is contained in:
zhanxiaoqi
2026-02-26 12:39:58 +08:00
committed by Xiang Xiao
parent 28749b8797
commit 4b09f34a45
2 changed files with 14 additions and 1 deletions
+10
View File
@@ -194,6 +194,16 @@ config MM_HEAP_MEMPOOL_THRESHOLD
if MM_HEAP_MEMPOOL_THRESHOLD > 0
config MM_HEAP_MEMPOOL_WAIT_RELEASE
bool "If wait for other tasks to release memory"
default n
---help---
If the macro is set to true, when the memory pool fails to allocate
available memory, the current task will block and wait for other tasks
to release memory. Once memory is released by other tasks, the blocked
task will be awakened and re-attempt to allocate memory from
the memory pool.
config MM_HEAP_MEMPOOL_EXPAND_SIZE
int "The expand size for each mempool in multiple mempool"
default 4096
+4 -1
View File
@@ -463,8 +463,11 @@ mempool_multiple_init(FAR const char *name,
pools[i].alloc = mempool_multiple_alloc_callback;
pools[i].free = mempool_multiple_free_callback;
pools[i].check = mempool_multiple_check;
#ifdef CONFIG_MM_HEAP_MEMPOOL_WAIT_RELEASE
pools[i].wait = true;
#else
pools[i].wait = false;
#endif
ret = mempool_init(pools + i, name);
if (ret < 0)
{