Hi,
I've been this blog post about
pmem allocator design. In the post, it says:
"Persistent heaps don’t have the luxury of virtual memory mappings. The memory
you
mmap is the memory you get, we can’t mix it."
I think by this you mean when memory is allocated, the pmem device driver will allocate a contiguous segment of persistent memory, map it to virtual memory and return the base address of that segment. This is very similar to the volatile C heap except that the pmem heap (memory pool) has fixed, predetermined size given as an argument to pmemobj_create. In contrast, when allocating disk-based files, the device driver accepts only fixed-size block allocations. The OS will find and allocate the required blocks from the disk and these blocks may or may not be contiguous. Either way, the OS can map all these blocks to a contiguous virtual memory segment. That's why only pmem suffers from internal fragmentation and that's why the pmem allocator has been designed differently from other traditional NVM allocators. Am I right? If this was the case, then why not designing the pmem device driver the same way as the disk driver?
Also, are there any radical differences between pmem allocator and dlmalloc/ptmalloc?
Also the blog post says:
"Contrasting that to a single allocated memory block. It
must be contiguous
and once allocated cannot be moved."
I think by "it" you referring to the virtual memory segment, right? Well, if the user obtained direct pointers to persistent memory then yes. But why would you want to move it?
Thanks.
-Hadi