On Tue, Jun 17, 2025 at 04:46:57PM -0700, Nicolin Chen wrote:
On Tue, Jun 17, 2025 at 08:01:36PM -0300, Jason Gunthorpe wrote:
On Tue, Jun 17, 2025 at 02:23:41PM -0700, Nicolin Chen wrote:
On Tue, Jun 17, 2025 at 08:59:48AM -0300, Jason Gunthorpe wrote:
On Mon, Jun 16, 2025 at 07:02:08PM -0700, Nicolin Chen wrote:
---breakdown--- After `posix_memalign()`: [ posix_memalign() memory ] ← malloc thinks it owns this
Then `mmap(aligned_ptr, ..., MAP_FIXED)`: [ anonymous mmap region ] ← malloc still thinks it owns this (!) ↑ mapped ---end---
Yes, this is correct and what we are doing here. The allocator always owns it and we are just replacing the memory with a different mmap.
Hmm, if allocator always owns it. Does that mean the munmap() [3] will release what [1] and [2] do (allocating and replacing)?
No, munmap doesn't destroy the allocator meta data.
Should we do something to that meta data?
My patch calls free on it which removes the metadata and might munmap the range (or re-use it, but that doesn't matter)
Jason