This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 4b09f34a4572cd00d2ef83a1ecdd626311011478 Author: zhanxiaoqi <[email protected]> AuthorDate: Thu Feb 26 12:39:58 2026 +0800 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 <[email protected]> --- mm/Kconfig | 10 ++++++++++ mm/mempool/mempool_multiple.c | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/mm/Kconfig b/mm/Kconfig index a5904dd19b2..6aa7a648031 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -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 diff --git a/mm/mempool/mempool_multiple.c b/mm/mempool/mempool_multiple.c index 92ec9a1e9e9..7f31b7ef368 100644 --- a/mm/mempool/mempool_multiple.c +++ b/mm/mempool/mempool_multiple.c @@ -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) {
