-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kernel: Introduce a way to specify minimum system heap size #65908
Conversation
Kconfig options with a HEAP_MEM_POOL_ADD_SIZE_ prefix should be used to set the minimum required system heap size. This helps prevent applications from creating a non-working image by trying to set a too small value. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Kconfig options with a HEAP_MEM_POOL_ADD_SIZE_ prefix should be used to set the minimum required system heap size. This helps prevent applications from creating a non-working image by trying to set a too small value. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Kconfig options with a HEAP_MEM_POOL_ADD_SIZE_ prefix should be used to set the minimum required system heap size. This helps prevent applications from creating a non-working image by trying to set a too small value. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Kconfig options with a HEAP_MEM_POOL_ADD_SIZE_ prefix should be used to set the minimum required system heap size. This helps prevent applications from creating a non-working image by trying to set a too small value. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Kconfig options with a HEAP_MEM_POOL_ADD_SIZE_ prefix should be used to set the minimum required system heap size. This helps prevent applications from creating a non-working image by trying to set a too small value. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Kconfig options with a HEAP_MEM_POOL_ADD_SIZE_ prefix should be used to set the minimum required system heap size. This helps prevent applications from creating a non-working image by trying to set a too small value. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Kconfig options with a HEAP_MEM_POOL_ADD_SIZE_ prefix should be used to set the minimum required system heap size. This helps prevent applications from creating a non-working image by trying to set a too small value. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Use the new HEAP_MEM_POOL_ADD_SIZE_ prefix to construct a minimum requirement for posix message queue usage. This way we can remove the "special case" default values from the HEAP_MEM_POOL_SIZE Kconfig definition. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This is needed so that module uses K_HEAP_MEM_POOL_SIZE for determining the availablility of the k_malloc family of functions. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
141984c
to
6949ab0
Compare
Rebased, and updated the libmetal reference to point at zephyrproject-rtos/libmetal#25 instead of zephyrproject-rtos/libmetal#23 |
This is needed so that module uses K_HEAP_MEM_POOL_SIZE for determining the availablility of the k_malloc family of functions. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Add a note about the new K_MEM_POOL_HEAP_SIZE define and the mechanism for specifying custom system heap size requirements. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
6949ab0
to
087c005
Compare
..and now rebased again with the final libmetal SHA after zephyrproject-rtos/libmetal#25 was merged Now all CI checks should (hopefully) be green. @nordicjm thanks for the thorough analysis of places that most likely still require updating. I think those updates can be done gradually after this PR has been merged. The idea with having similar template support as we have for logging kconfig symbols sounds like a nice follow-up improvement as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved.
Minor nit observed. Kconfig.defconfigs should generally not define settings, only adjust defaults of settings defined elsewhere.
But as this PR is changing HEAP_MEM_POOL_SIZE -> HEAP_MEM_POOL_ADD_SIZE, then moving this to the board's Kconfig can done as followup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great now, thank you!
I know that it's merged already but it would be better if |
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:
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 time.
Fixes #65722