From 60f79705a31546b3b241d13aee19515d579682c5 Mon Sep 17 00:00:00 2001 From: Felipe Neves Date: Mon, 19 Oct 2020 14:30:51 -0300 Subject: [PATCH] heap: tune the tlsf control structure to reduce per-pool overhead --- components/heap/heap_tlsf.h | 1 + components/heap/heap_tlsf_config.h | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/components/heap/heap_tlsf.h b/components/heap/heap_tlsf.h index c7152fe5a3..24e4c1659f 100644 --- a/components/heap/heap_tlsf.h +++ b/components/heap/heap_tlsf.h @@ -43,6 +43,7 @@ #include #include #include +#include "sdkconfig.h" #include "heap_tlsf_config.h" #if defined(__cplusplus) diff --git a/components/heap/heap_tlsf_config.h b/components/heap/heap_tlsf_config.h index 8d1958b5c9..ed7568eef9 100644 --- a/components/heap/heap_tlsf_config.h +++ b/components/heap/heap_tlsf_config.h @@ -43,7 +43,7 @@ enum tlsf_config ** values require more memory in the control structure. Values of ** 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. */ ALIGN_SIZE_LOG2 = 2, @@ -63,7 +63,11 @@ enum tlsf_config /* Tunning the first level, we can reduce TLSF pool overhead * 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), FL_INDEX_SHIFT = (SL_INDEX_COUNT_LOG2 + ALIGN_SIZE_LOG2),