On Thu, Jul 11, 2019 at 10:30:52PM +0000, co...@sdf.org wrote: > hi folks, while skimming jemalloc, noticed a comment about our old code > being better.
* Ideally, there would be a way to specify alignment to mmap() (like * NetBSD has), but in the absence of such a feature, we have to work * hard to efficiently create aligned mappings. The reliable, but * slow method is to create a mapping that is over-sized, then trim the * excess. However, that always results in one or two calls to * os_pages_unmap(), and it can leave holes in the process's virtual * memory map if memory grows downward. * * Optimistically try mapping precisely the right amount before falling * back to the slow method, with the expectation that the optimistic * approach works most of the time. So if that doesn't work, it'll loop in pages_map_slow, hoping to get aligned stuff.