mm/mm_heap: add mempool to optimize small block performance

There are many small memory block in NuttX system, eg: struct tcb_s,
struct inode, etc, and several disadvantages about them:
1.Their frequent allocate and free cause the system memory fragmentation.
2.Since each memory block has an overhead, the utilization of small memory
blocks is relatively low, which will cause memory waste.

So we can use mempool to alloc smallo block, to improve alloc speed
and utilization, to reduce fragmentation.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
dongjiuzhu1
2022-10-30 11:34:24 +08:00
committed by Xiang Xiao
parent 7cd325f3be
commit c82f44c4f3
8 changed files with 112 additions and 1 deletions
+16
View File
@@ -172,6 +172,22 @@ config MM_SHM
Build in support for the shared memory interfaces shmget(), shmat(),
shmctl(), and shmdt().
config MM_HEAP_MEMPOOL_THRESHOLD
int "The size of threshold to avoid using multiple mempool in heap"
default 0
---help---
If the size of the memory requested by the user is less
than the threshold, the memory will be requested from the
multiple mempool by default.
config MM_HEAP_MEMPOOL_EXPAND
int "The expand size for each mempool in multiple mempool"
default 1024
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.
config FS_PROCFS_EXCLUDE_MEMPOOL
bool "Exclude mempool"
default DEFAULT_SMALL