1
0
Fork 0
forked from nuttx/nuttx-update

mempool: add the minimum size configuration of mempool

The minimum size of mempool can be configured through CONFIG_MM_MPOOL_MINISIZE

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
This commit is contained in:
liwenxiang1 2024-05-06 21:42:49 +08:00 committed by Xiang Xiao
parent 821196eb22
commit 015a45517e
3 changed files with 18 additions and 3 deletions

View file

@ -216,10 +216,11 @@ config MM_HEAP_MEMPOOL_THRESHOLD
== 0 Enable pool feature, but disable the umm/kmm pool function.
< 0 Disable pool feature.
if MM_HEAP_MEMPOOL_THRESHOLD > 0
config MM_HEAP_MEMPOOL_EXPAND_SIZE
int "The expand size for each mempool in multiple mempool"
default 4096
depends on MM_HEAP_MEMPOOL_THRESHOLD > 0
---help---
This size describes the size of each expansion of each memory
pool with insufficient memory in the multi-level memory pool.
@ -227,17 +228,23 @@ config MM_HEAP_MEMPOOL_EXPAND_SIZE
config MM_HEAP_MEMPOOL_DICTIONARY_EXPAND_SIZE
int "The expand size for multiple mempool's dictionary"
default MM_HEAP_MEMPOOL_EXPAND_SIZE
depends on MM_HEAP_MEMPOOL_THRESHOLD > 0
---help---
This size describes the multiple mempool dictionary expand.
config MM_HEAP_MEMPOOL_CHUNK_SIZE
int "The multiples pool chunk size"
default 0
depends on MM_HEAP_MEMPOOL_THRESHOLD > 0
---help---
This size describes the multiple mempool chunk size.
config MM_MIN_BLKSIZE
int "Minimum memory block size"
default 0
---help---
Users can configure the minimum memory block size as needed
endif # MM_HEAP_MEMPOOL_THRESHOLD > 0
config MM_HEAP_MEMPOOL_BACKTRACE_SKIP
int "The skip depth of backtrace for mempool"
default 6

View file

@ -316,7 +316,11 @@ mm_initialize_pool(FAR const char *name,
for (i = 0; i < MEMPOOL_NPOOLS; i++)
{
# if CONFIG_MM_MIN_BLKSIZE != 0
poolsize[i] = (i + 1) * CONFIG_MM_MIN_BLKSIZE;
# else
poolsize[i] = (i + 1) * MM_MIN_CHUNK;
# endif
}
def.poolsize = poolsize;

View file

@ -1021,7 +1021,11 @@ mm_initialize_pool(FAR const char *name,
for (i = 0; i < MEMPOOL_NPOOLS; i++)
{
# if CONFIG_MM_MIN_BLKSIZE != 0
poolsize[i] = (i + 1) * CONFIG_MM_MIN_BLKSIZE;
# else
poolsize[i] = (i + 1) * tlsf_align_size();
# endif
}
def.poolsize = poolsize;