heap: tune the tlsf control structure to reduce per-pool overhead

This commit is contained in:
Felipe Neves 2020-10-19 14:30:51 -03:00 committed by Angus Gratton
parent e2716690bc
commit 60f79705a3
2 changed files with 7 additions and 2 deletions

View File

@ -43,6 +43,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stddef.h> #include <stddef.h>
#include "sdkconfig.h"
#include "heap_tlsf_config.h" #include "heap_tlsf_config.h"
#if defined(__cplusplus) #if defined(__cplusplus)

View File

@ -43,7 +43,7 @@ enum tlsf_config
** values require more memory in the control structure. Values of ** values require more memory in the control structure. Values of
** 4 or 5 are typical. ** 4 or 5 are typical.
*/ */
SL_INDEX_COUNT_LOG2 = 5, SL_INDEX_COUNT_LOG2 = 2,
/* All allocation sizes and addresses are aligned to 4 bytes. */ /* All allocation sizes and addresses are aligned to 4 bytes. */
ALIGN_SIZE_LOG2 = 2, ALIGN_SIZE_LOG2 = 2,
@ -63,7 +63,11 @@ enum tlsf_config
/* Tunning the first level, we can reduce TLSF pool overhead /* Tunning the first level, we can reduce TLSF pool overhead
* in exchange of manage a pool smaller than 4GB * in exchange of manage a pool smaller than 4GB
*/ */
FL_INDEX_MAX = 30, #ifndef CONFIG_SPIRAM
FL_INDEX_MAX = 18, //Each pool can have up 256KB
#else
FL_INDEX_MAX = 23, //Each pool can have up 8MB
#endif
SL_INDEX_COUNT = (1 << SL_INDEX_COUNT_LOG2), SL_INDEX_COUNT = (1 << SL_INDEX_COUNT_LOG2),
FL_INDEX_SHIFT = (SL_INDEX_COUNT_LOG2 + ALIGN_SIZE_LOG2), FL_INDEX_SHIFT = (SL_INDEX_COUNT_LOG2 + ALIGN_SIZE_LOG2),