lib: os: group heap related kconfigs under a menu
This groups the heap related kconfigs under a menu so they are under a group (!). Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
0f7c31e0a4
commit
5604b98f21
2 changed files with 108 additions and 99 deletions
101
lib/os/Kconfig
101
lib/os/Kconfig
|
@ -21,97 +21,6 @@ config BASE64
|
||||||
help
|
help
|
||||||
Enable base64 encoding and decoding functionality
|
Enable base64 encoding and decoding functionality
|
||||||
|
|
||||||
config SYS_HEAP_VALIDATE
|
|
||||||
bool "Enable internal heap validity checking"
|
|
||||||
help
|
|
||||||
The sys_heap implementation is instrumented for extensive
|
|
||||||
internal validation. Leave this off by default, unless
|
|
||||||
modifying the heap code or (maybe) when running in
|
|
||||||
environments that require sensitive detection of memory
|
|
||||||
corruption.
|
|
||||||
|
|
||||||
config SYS_HEAP_ALLOC_LOOPS
|
|
||||||
int "Number of tries in the inner heap allocation loop"
|
|
||||||
default 3
|
|
||||||
help
|
|
||||||
The sys_heap allocator bounds the number of tries from the
|
|
||||||
smallest chunk level (the one that might not fit the
|
|
||||||
requested allocation) to maintain constant time performance.
|
|
||||||
Setting this to a high level will cause the heap to return
|
|
||||||
more successful allocations in situations of high
|
|
||||||
fragmentation, at the cost of potentially significant
|
|
||||||
(linear time) searching of the free list. The default is
|
|
||||||
three, which results in an allocator with good statistical
|
|
||||||
properties ("most" allocations that fit will succeed) but
|
|
||||||
keeps the maximum runtime at a tight bound so that the heap
|
|
||||||
is useful in locked or ISR contexts.
|
|
||||||
|
|
||||||
config SYS_HEAP_RUNTIME_STATS
|
|
||||||
bool "System heap runtime statistics"
|
|
||||||
help
|
|
||||||
Gather system heap runtime statistics.
|
|
||||||
|
|
||||||
config SYS_HEAP_LISTENER
|
|
||||||
bool "Enable sys_heap event notifications"
|
|
||||||
select HEAP_LISTENER
|
|
||||||
help
|
|
||||||
This allows application to listen for sys_heap events,
|
|
||||||
such as memory allocation and de-allocation.
|
|
||||||
|
|
||||||
config HEAP_LISTENER
|
|
||||||
bool
|
|
||||||
help
|
|
||||||
Hidden option to enable API for registering and notifying
|
|
||||||
listeners of certain events related to a heap usage,
|
|
||||||
such as the heap resize.
|
|
||||||
|
|
||||||
choice
|
|
||||||
prompt "Supported heap sizes"
|
|
||||||
depends on !64BIT
|
|
||||||
default SYS_HEAP_SMALL_ONLY if (SRAM_SIZE <= 256)
|
|
||||||
default SYS_HEAP_AUTO
|
|
||||||
help
|
|
||||||
Heaps using reduced-size chunk headers can accommodate so called
|
|
||||||
"small" heaps with a total size of 262136 bytes or less.
|
|
||||||
|
|
||||||
Heaps using full-size chunk headers can have a total size up to
|
|
||||||
16383 megabytes. The overhead is of course bigger.
|
|
||||||
|
|
||||||
On 32-bit system the tradeoff is selectable between:
|
|
||||||
|
|
||||||
- "small" heaps with low memory and runtime overhead;
|
|
||||||
|
|
||||||
- "big" heaps with bigger memory overhead even for small heaps;
|
|
||||||
|
|
||||||
- "auto" providing optimal memory overhead in all cases but with
|
|
||||||
a higher runtime overhead and somewhat bigger code footprint.
|
|
||||||
|
|
||||||
On 64-bit systems the "big" chunk header size conveniently provides
|
|
||||||
the needed alignment on returned memory allocations. Small chunk
|
|
||||||
headers would require alignment padding up to the big header size
|
|
||||||
anyway so "big" heap is the only option in that case.
|
|
||||||
|
|
||||||
config SYS_HEAP_SMALL_ONLY
|
|
||||||
bool "Support for small heaps only"
|
|
||||||
help
|
|
||||||
Select this to optimize the code and memory usage if all your
|
|
||||||
heaps are 262136 bytes or less.
|
|
||||||
|
|
||||||
config SYS_HEAP_BIG_ONLY
|
|
||||||
bool "Support for big heaps only"
|
|
||||||
help
|
|
||||||
Select this to optimize the code for big heaps only. This can
|
|
||||||
accommodate any heap size but memory usage won't be as
|
|
||||||
efficient with small sized heaps.
|
|
||||||
|
|
||||||
config SYS_HEAP_AUTO
|
|
||||||
bool "Support for both small and big heaps at run time"
|
|
||||||
help
|
|
||||||
This option optimizes memory usage for each heap according to
|
|
||||||
their size albeit with some overhead in code size and execution.
|
|
||||||
|
|
||||||
endchoice
|
|
||||||
|
|
||||||
config PRINTK_SYNC
|
config PRINTK_SYNC
|
||||||
bool "Serialize printk() calls"
|
bool "Serialize printk() calls"
|
||||||
default y if SMP && MP_NUM_CPUS > 1
|
default y if SMP && MP_NUM_CPUS > 1
|
||||||
|
@ -129,14 +38,6 @@ config MPSC_PBUF
|
||||||
storing variable length packets in a circular way and operate directly
|
storing variable length packets in a circular way and operate directly
|
||||||
on the buffer memory.
|
on the buffer memory.
|
||||||
|
|
||||||
config SHARED_MULTI_HEAP
|
|
||||||
bool "Shared multi-heap manager"
|
|
||||||
help
|
|
||||||
Enable support for a shared multi-heap manager that uses the
|
|
||||||
multi-heap allocator to manage a set of reserved memory regions with
|
|
||||||
different capabilities / attributes (cacheable, non-cacheable,
|
|
||||||
etc...) defined in the DT.
|
|
||||||
|
|
||||||
if MPSC_PBUF
|
if MPSC_PBUF
|
||||||
config MPSC_CLEAR_ALLOCATED
|
config MPSC_CLEAR_ALLOCATED
|
||||||
bool "Clear allocated packet"
|
bool "Clear allocated packet"
|
||||||
|
@ -159,4 +60,6 @@ config UTF8
|
||||||
|
|
||||||
rsource "Kconfig.cbprintf"
|
rsource "Kconfig.cbprintf"
|
||||||
|
|
||||||
|
rsource "Kconfig.heap"
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
106
lib/os/Kconfig.heap
Normal file
106
lib/os/Kconfig.heap
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
# Copyright (c) 2021 Intel Corporation
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
menu "Heap and Memory Allocation"
|
||||||
|
|
||||||
|
config SYS_HEAP_VALIDATE
|
||||||
|
bool "Enable internal heap validity checking"
|
||||||
|
help
|
||||||
|
The sys_heap implementation is instrumented for extensive
|
||||||
|
internal validation. Leave this off by default, unless
|
||||||
|
modifying the heap code or (maybe) when running in
|
||||||
|
environments that require sensitive detection of memory
|
||||||
|
corruption.
|
||||||
|
|
||||||
|
config SYS_HEAP_ALLOC_LOOPS
|
||||||
|
int "Number of tries in the inner heap allocation loop"
|
||||||
|
default 3
|
||||||
|
help
|
||||||
|
The sys_heap allocator bounds the number of tries from the
|
||||||
|
smallest chunk level (the one that might not fit the
|
||||||
|
requested allocation) to maintain constant time performance.
|
||||||
|
Setting this to a high level will cause the heap to return
|
||||||
|
more successful allocations in situations of high
|
||||||
|
fragmentation, at the cost of potentially significant
|
||||||
|
(linear time) searching of the free list. The default is
|
||||||
|
three, which results in an allocator with good statistical
|
||||||
|
properties ("most" allocations that fit will succeed) but
|
||||||
|
keeps the maximum runtime at a tight bound so that the heap
|
||||||
|
is useful in locked or ISR contexts.
|
||||||
|
|
||||||
|
config SYS_HEAP_RUNTIME_STATS
|
||||||
|
bool "System heap runtime statistics"
|
||||||
|
help
|
||||||
|
Gather system heap runtime statistics.
|
||||||
|
|
||||||
|
config SYS_HEAP_LISTENER
|
||||||
|
bool "Enable sys_heap event notifications"
|
||||||
|
select HEAP_LISTENER
|
||||||
|
help
|
||||||
|
This allows application to listen for sys_heap events,
|
||||||
|
such as memory allocation and de-allocation.
|
||||||
|
|
||||||
|
config HEAP_LISTENER
|
||||||
|
bool
|
||||||
|
help
|
||||||
|
Hidden option to enable API for registering and notifying
|
||||||
|
listeners of certain events related to a heap usage,
|
||||||
|
such as the heap resize.
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "Supported heap sizes"
|
||||||
|
depends on !64BIT
|
||||||
|
default SYS_HEAP_SMALL_ONLY if (SRAM_SIZE <= 256)
|
||||||
|
default SYS_HEAP_AUTO
|
||||||
|
help
|
||||||
|
Heaps using reduced-size chunk headers can accommodate so called
|
||||||
|
"small" heaps with a total size of 262136 bytes or less.
|
||||||
|
|
||||||
|
Heaps using full-size chunk headers can have a total size up to
|
||||||
|
16383 megabytes. The overhead is of course bigger.
|
||||||
|
|
||||||
|
On 32-bit system the tradeoff is selectable between:
|
||||||
|
|
||||||
|
- "small" heaps with low memory and runtime overhead;
|
||||||
|
|
||||||
|
- "big" heaps with bigger memory overhead even for small heaps;
|
||||||
|
|
||||||
|
- "auto" providing optimal memory overhead in all cases but with
|
||||||
|
a higher runtime overhead and somewhat bigger code footprint.
|
||||||
|
|
||||||
|
On 64-bit systems the "big" chunk header size conveniently provides
|
||||||
|
the needed alignment on returned memory allocations. Small chunk
|
||||||
|
headers would require alignment padding up to the big header size
|
||||||
|
anyway so "big" heap is the only option in that case.
|
||||||
|
|
||||||
|
config SYS_HEAP_SMALL_ONLY
|
||||||
|
bool "Support for small heaps only"
|
||||||
|
help
|
||||||
|
Select this to optimize the code and memory usage if all your
|
||||||
|
heaps are 262136 bytes or less.
|
||||||
|
|
||||||
|
config SYS_HEAP_BIG_ONLY
|
||||||
|
bool "Support for big heaps only"
|
||||||
|
help
|
||||||
|
Select this to optimize the code for big heaps only. This can
|
||||||
|
accommodate any heap size but memory usage won't be as
|
||||||
|
efficient with small sized heaps.
|
||||||
|
|
||||||
|
config SYS_HEAP_AUTO
|
||||||
|
bool "Support for both small and big heaps at run time"
|
||||||
|
help
|
||||||
|
This option optimizes memory usage for each heap according to
|
||||||
|
their size albeit with some overhead in code size and execution.
|
||||||
|
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
config SHARED_MULTI_HEAP
|
||||||
|
bool "Shared multi-heap manager"
|
||||||
|
help
|
||||||
|
Enable support for a shared multi-heap manager that uses the
|
||||||
|
multi-heap allocator to manage a set of reserved memory regions with
|
||||||
|
different capabilities / attributes (cacheable, non-cacheable,
|
||||||
|
etc...) defined in the DT.
|
||||||
|
|
||||||
|
endmenu
|
Loading…
Add table
Add a link
Reference in a new issue