heap: simplify heap size calculation#10673
Open
lyakh wants to merge 1 commit intothesofproject:mainfrom
Open
Conversation
Fixes two issues: 1. remove confusingly named CONFIG_SOF_ZEPHYR_VIRTUAL_HEAP_SIZE since it isn't used for virtual heap but for a traditional one - not using run-time memory mapping. 2. instead of adding CONFIG_SOF_ZEPHYR_VIRTUAL_HEAP_SIZE switch back to using CONFIG_SOF_ZEPHYR_HEAP_SIZE also when CONFIG_VIRTUAL_HEAP is selected by just adjusting its value. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Simplifies heap sizing under VIRTUAL_HEAP by removing the separate “virtual heap size” Kconfig symbol and relying on SOF_ZEPHYR_HEAP_SIZE (with an adjusted default) instead.
Changes:
- Removed
SOF_ZEPHYR_VIRTUAL_HEAP_SIZEKconfig option and theHEAPMEM_SIZEoverride inalloc.cwhenCONFIG_VIRTUAL_HEAPis enabled. - Added a
VIRTUAL_HEAP-specific default forSOF_ZEPHYR_HEAP_SIZE.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| zephyr/lib/alloc.c | Drops the conditional HEAPMEM_SIZE redefinition for CONFIG_VIRTUAL_HEAP. |
| zephyr/Kconfig | Removes the dedicated virtual heap size symbol and sets a smaller default heap size when VIRTUAL_HEAP is enabled. |
Comments suppressed due to low confidence (2)
zephyr/lib/alloc.c:1
- With the
HEAPMEM_SIZEoverride removed underCONFIG_VIRTUAL_HEAP, this block now relies onHEAPMEM_SIZEbeing defined correctly elsewhere. To make the contract explicit and avoid future regressions from include/macro ordering changes, consider definingHEAPMEM_SIZEin one place (or usingCONFIG_SOF_ZEPHYR_HEAP_SIZEdirectly at the allocation site) rather than depending on implicit prior definitions.
// SPDX-License-Identifier: BSD-3-Clause
zephyr/Kconfig:1
- Now that
SOF_ZEPHYR_HEAP_SIZEchanges default behavior underVIRTUAL_HEAP, the help text forSOF_ZEPHYR_HEAP_SIZEshould be updated to capture the guidance that was previously documented underSOF_ZEPHYR_VIRTUAL_HEAP_SIZE(e.g., that this value is reduced when buffers are virtualized and must still respect physical memory limits / DT-defined memory). This avoids configuration confusion after removing the dedicated symbol.
config SOF_FULL_ZEPHYR_APPLICATION
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes two issues: