Skip to content

Commit

Permalink
kernel: dynamic: Add a constraint for user stacks
Browse files Browse the repository at this point in the history
Support for dynamic thread stack on userspace only
works with MMU. On MPUs we depend in the number of
partitions available in the hw and in the number of
partitions used.

Because of this constraint, enable heap based allocation
only when userspace is not enabled in MPU devices.

Signed-off-by: Flavio Ceolin <[email protected]>
  • Loading branch information
Flavio Ceolin committed Jul 1, 2023
1 parent 8cba0c0 commit 6b1d662
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions kernel/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ config DYNAMIC_THREAD_STACK_SIZE
help
Default stack size (in bytes) for dynamic threads.

if !USERSPACE || (USERSPACE && MMU)
config DYNAMIC_THREAD_ALLOC
bool "Support heap-allocated thread objects and stacks"
help
Expand All @@ -228,6 +229,7 @@ config DYNAMIC_THREAD_ALLOC

Only use this type of allocation in situations
where malloc is permitted.
endif

config DYNAMIC_THREAD_POOL_SIZE
int "Number of statically pre-allocated threads"
Expand All @@ -248,12 +250,14 @@ choice DYNAMIC_THREAD_PREFER
CONFIG_DYNAMIC_THREAD_POOL_SIZE > 0, then the user may
specify the order in which allocation is attmpted.

if !USERSPACE || (USERSPACE && MMU)
config DYNAMIC_THREAD_PREFER_ALLOC
bool "Prefer heap-based allocation"
depends on DYNAMIC_THREAD_ALLOC
help
Select this option to attempt a heap-based allocation
prior to any pool-based allocation.
endif

config DYNAMIC_THREAD_PREFER_POOL
bool "Prefer pool-based allocation"
Expand Down

0 comments on commit 6b1d662

Please sign in to comment.