posix_memalign() in libvmmalloc.c

23 views
Skip to first unread message

Steve Byan's Lists

unread,
Apr 26, 2016, 11:15:14 AM4/26/16
to pmem
I'm curious as to why libvmmalloc.c reimplements posix_memalign using je_vmem_memalign() and je_vmem_pool_aligned_alloc() rather than simply delegating to je_vmem_posix_memalign()?

The use of je_vmem_memalign() causes problems on platforms that don't include that legacy API. The jemalloc configure logic doesn't export that function unless the platform already provides memalign(). Should I force jemalloc to export je_vmem_memalign() regardless of the platform, or would it be better to recode posix_memalign() to avoid je_vmem_memalign()?

Best regards,
-Steve

--
Steve Byan
stev...@me.com
Littleton, MA



Krzysztof Czurylo

unread,
Apr 26, 2016, 2:53:05 PM4/26/16
to pmem
Hi Steve,

To be honest, I don't see any reason for not using je_vmem_posix_memalign().  Simply, I didn't realize there could be any problem with je_vmem_memalign().  Perhaps I got inspired by jemalloc internals, as all of memalign(), posix_memalign(), aligned_alloc() and valloc() are implemented by a call to internal function imemalign().

Anyway, I think we should modify posix_memalign() as you described.  I'll make a 
Also, instead of changing jemalloc configure logic and forcing it to export memalign(), we should rather modify the way how VMMALLOC_OVERRIDE_MEMALIGN is defined and make it depend on JEMALLOC_OVERRIDE_MEMALIGN definition.

Thanks,
K.

Krzysztof Czurylo

unread,
Apr 26, 2016, 3:02:34 PM4/26/16
to pmem
I was going to say I'll make a patch shortly. Here it is:

K.

Steve Byan's Lists

unread,
Apr 27, 2016, 11:01:05 AM4/27/16
to Krzysztof Czurylo, pmem

> On Apr 26, 2016, at 3:02 PM, Krzysztof Czurylo <krzyszto...@intel.com> wrote:
>
> I was going to say I'll make a patch shortly. Here it is:
> https://github.com/pmem/nvml/pull/776

Thanks very much! Works great.
Reply all
Reply to author
Forward
0 new messages