zephyr/kernel
Johan Hedberg 3fbf12487c kernel: Introduce a way to specify minimum system heap size
There are several subsystems and boards which require a relatively large
system heap (used by k_malloc()) to function properly. This became even
more notable with the recent introduction of the ACPICA library, which
causes ACPI-using boards to require a system heap of up to several
megabytes in size.

Until now, subsystems and boards have tried to solve this by having
Kconfig overlays which modify the default value of HEAP_MEM_POOL_SIZE.
This works ok, except when applications start explicitly setting values
in their prj.conf files:

$ git grep CONFIG_HEAP_MEM_POOL_SIZE= tests samples|wc -l
     157

The vast majority of values set by current sample or test applications
is much too small for subsystems like ACPI, which results in the
application not being able to run on such boards.

To solve this situation, we introduce support for subsystems to specify
their own custom system heap size requirement. Subsystems do
this by defining Kconfig options with the prefix HEAP_MEM_POOL_ADD_SIZE_.
The final value of the system heap is the sum of the custom
minimum requirements, or the value existing HEAP_MEM_POOL_SIZE option,
whichever is greater.

We also introduce a new HEAP_MEM_POOL_IGNORE_MIN Kconfig option which
applications can use to force a lower value than what subsystems have
specficied, however this behavior is disabled by default.

Whenever the minimum is greater than the requested value a CMake warning
will be issued in the build output.

This patch ends up modifying several places outside of kernel code,
since the presence of the system heap is no longer detected using a
non-zero CONFIG_HEAP_MEM_POOL_SIZE value, rather it's now detected using
a new K_HEAP_MEM_POOL_SIZE value that's evaluated at build.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2023-12-20 11:01:42 +01:00
..
include kernel: Introduce a way to specify minimum system heap size 2023-12-20 11:01:42 +01:00
paging kernel: mm: only include demand_paging.h if needed 2023-11-23 10:01:45 +01:00
atomic_c.c syscall: rename Z_OOPS -> K_OOPS 2023-11-03 11:46:52 +01:00
banner.c kernel: banner: Allow for customising version 2023-08-21 10:09:46 +02:00
busy_wait.c kernel: Use k_us_to_cyc_ceil32 in k_busy_wait 2023-12-05 09:24:28 +01:00
CMakeLists.txt kernel: Introduce a way to specify minimum system heap size 2023-12-20 11:01:42 +01:00
compiler_stack_protect.c kernel: canaries: Allow using TLS to store it 2023-08-08 19:08:04 -04:00
condvar.c syscall: rename Z_OOPS -> K_OOPS 2023-11-03 11:46:52 +01:00
device.c syscall: rename Z_OOPS -> K_OOPS 2023-11-03 11:46:52 +01:00
dynamic.c kernel: threads: Do not use string compare instead of bit ops 2023-12-18 12:24:53 +01:00
dynamic_disabled.c kernel: dynamic: declare dynamic stubs when disabled 2023-07-24 12:59:43 -04:00
errno.c kernel: move syscall_handler.h to internal include directory 2023-11-03 11:46:52 +01:00
events.c syscall: rename Z_OOPS -> K_OOPS 2023-11-03 11:46:52 +01:00
fatal.c debug: coredump: handle xtensa coredump like everyone else 2023-12-14 09:32:27 +01:00
futex.c syscall: rename Z_SYSCALL_ to K_SYSCALL_ 2023-11-03 11:46:52 +01:00
idle.c kernel: move wait_q.h header to be internal 2023-09-12 12:55:36 -04:00
init.c kernel: init: conditional .bss section zeroing 2023-11-08 10:07:26 +01:00
Kconfig kernel: Introduce a way to specify minimum system heap size 2023-12-20 11:01:42 +01:00
Kconfig.vm mm: introduce CONFIG_KERNEL_VM_USE_CUSTOM_MEM_RANGE_CHECK 2023-10-20 15:08:34 +02:00
kheap.c kernel: move wait_q.h header to be internal 2023-09-12 12:55:36 -04:00
mailbox.c kernel: Remove legacy mem block from mailbox 2023-10-13 09:56:02 +03:00
main_weak.c kernel: Switch main return type from void to int 2023-04-14 07:49:41 +09:00
mem_domain.c init: remove the need for a dummy device pointer in SYS_INIT functions 2023-04-12 14:28:07 +00:00
mem_slab.c kernel: object: rename z_object_init to k_object_init 2023-11-03 11:46:52 +01:00
mempool.c kernel: Introduce a way to specify minimum system heap size 2023-12-20 11:01:42 +01:00
mmu.c kernel: mmu: no need to expose z_free_page_count 2023-12-12 18:46:21 +00:00
msg_q.c syscall: rename Z_OOPS -> K_OOPS 2023-11-03 11:46:52 +01:00
mutex.c llext: export some symbols 2023-12-01 10:08:12 -05:00
obj_core.c kernel: Integrate object core statistics 2023-09-30 08:04:14 +03:00
pipes.c kernel: Apply const to k_pipe_put() parameter 2023-12-15 14:51:35 -05:00
poll.c syscall: rename Z_OOPS -> K_OOPS 2023-11-03 11:46:52 +01:00
queue.c syscall: rename Z_OOPS -> K_OOPS 2023-11-03 11:46:52 +01:00
sched.c kernel: Update k_sleep() and k_usleep() return values 2023-12-07 10:41:00 +00:00
sem.c syscall: rename Z_OOPS -> K_OOPS 2023-11-03 11:46:52 +01:00
smp.c kernel: rename shadow variables 2023-08-10 08:14:12 +00:00
stack.c syscall: rename Z_OOPS -> K_OOPS 2023-11-03 11:46:52 +01:00
system_work_q.c init: remove the need for a dummy device pointer in SYS_INIT functions 2023-04-12 14:28:07 +00:00
thread.c llext: export some symbols 2023-12-01 10:08:12 -05:00
timeout.c kernel: timeout: fix issue with z_timeout_expires 2023-11-30 12:22:54 +01:00
timer.c syscall: rename Z_OOPS -> K_OOPS 2023-11-03 11:46:52 +01:00
usage.c kernel: Integrate object core statistics 2023-09-30 08:04:14 +03:00
userspace.c syscall: rename Z_SYSCALL_ to K_SYSCALL_ 2023-11-03 11:46:52 +01:00
userspace_handler.c syscall: rename Z_OOPS -> K_OOPS 2023-11-03 11:46:52 +01:00
version.c
work.c kernel: work: check handler when submit to queue 2023-10-05 13:43:07 +01:00
xip.c kernel: canaries: Allow using TLS to store it 2023-08-08 19:08:04 -04:00