Uh oh!
There was an error while loading. Please reload this page.
regions_mm: Fix vhm allocator behavior on memory freeing - #9539
Conversation
Platforms based on xtensa have a non-coherent cache between cores. Before releasing a memory block, it is necessary to invalidate the cache. This memory block can be allocated by another core and performing cache writeback by the previous owner will destroy current content of the main memory. Invalidate cache when freeing allocated memory block. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
lgirdwood
left a comment
There was a problem hiding this comment.
@softwarecki LGTM (just have an open on naming) , btw do we need to perform any cache operation on the heap region metadata after the free() ?
@andyross pls review.
Uh oh!
There was an error while loading. Please reload this page.
softwarecki
commented
Oct 3, 2024
Metadata is stored in a separate location, not in a unallocated memory. |
The memory block allocated by the allocator may be larger than a requested one. If the allocated block size exceeds the memory page size, only enough pages are mapped to satisfy the request. Thanks to this optimization, it don't map memory pages that will not be used. When freeing memory, the allocator knows only size of the allocated block. Information about the number of pages actually mapped isn't stored anywhere. Before unmapping memory, determine the number of mapped pages to avoid error when trying to unmap unmapped memory. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
tmleman
left a comment
There was a problem hiding this comment.
LGTM, I would only consider whether it's worth using the CONFIG_INCOHERENT config here.
kv2019i
commented
Oct 7, 2024
Ready to go when CI passes, @softwarecki can you check the Intel internal CI fail? |
softwarecki
commented
Oct 8, 2024
SOFCI TEST |
Platforms based on xtensa have a non-coherent cache between cores. Before releasing a memory block, it is necessary to invalidate the cache. This memory block can be allocated by another core and performing cache writeback by the previous owner will destroy current content of the main memory.
Invalidate cache when freeing allocated memory block.
The memory block allocated by the allocator may be larger than a requested one. If the allocated block size exceeds the memory page size, only enough pages are mapped to satisfy the request. Thanks to this optimization, it don't map memory pages that will not be used. When freeing memory, the allocator knows only size of the allocated block. Information about the
number of pages actually mapped isn't stored anywhere.
Before unmapping memory, determine the number of mapped pages to avoid error when trying to unmap unmapped memory.