diff --git a/mm/Kconfig b/mm/Kconfig index 61953656778..088d178994b 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -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 diff --git a/mm/mm_heap/mm_initialize.c b/mm/mm_heap/mm_initialize.c index 767cf38b494..4b884c4a056 100644 --- a/mm/mm_heap/mm_initialize.c +++ b/mm/mm_heap/mm_initialize.c @@ -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; diff --git a/mm/tlsf/mm_tlsf.c b/mm/tlsf/mm_tlsf.c index a90853387d1..816d5e0973a 100644 --- a/mm/tlsf/mm_tlsf.c +++ b/mm/tlsf/mm_tlsf.c @@ -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;