-
Notifications
You must be signed in to change notification settings - Fork 349
regions_mm: Fix vhm allocator behavior on memory freeing #9539
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
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>
3d8a561 to
30bb812
Compare
lgirdwood
left a comment
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.
@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.
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>
30bb812 to
516176b
Compare
tmleman
left a comment
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.
LGTM, I would only consider whether it's worth using the CONFIG_INCOHERENT config here.
|
Ready to go when CI passes, @softwarecki can you check the Intel internal CI fail? |
|
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.