[petsc-dev] Using multiple mallocs with PETSc

Jed Brown jed at jedbrown.org
Sat Mar 11 11:00:15 CST 2017


Jeff Hammond <jeff.science at gmail.com> writes:
> I agree 100% that multithreaded codes that fault pages from the main thread in a NUMA environment are doing something wrong ;-)
>
> Does calloc *guarantee* pages are not mapped? If I calloc(8), do I get the zero page or part of the arena that's already mapped that is zeroed by the heap manager?

Is your argument that calloc() should never be used in multi-threaded code?

If the allocation is larger than MMAP_THRESHOLD (128 KiB by default for
glibc) then it calls mmap.  This obviously leaves an intermediate size
that could be poorly mapped (assuming 4 KiB pages), but it's also so
small that it easily fits in cache.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20170311/8daf6e55/attachment.sig>


More information about the petsc-dev mailing list