4e2e3dd Fix fork-related bugs.
jasone at canonware.com
Tue Mar 20 09:53:12 PDT 2012
On Mar 20, 2012, at 9:50 AM, Mike Hommey wrote:
> On Mon, Mar 19, 2012 at 07:02:48AM -0700, Jason Evans wrote:
>> On Mar 19, 2012, at 4:57 AM, Mike Hommey wrote:
>>> This commit broke building on OSX, because jemalloc_postfork, used
>>> in zone.c, isn't there anymore.
>> Thanks for the heads up on this and the __thread regression. Clearly
>> it's time for me to add support for Lion so that I can start testing
>> on OS X again. =)
> Since I looked at the OSX libc source, I have some additional
> information about force_lock and force_unlock in the introspection
> struct. As it turns out, these functions are called before and after
> forking, so they actually have the exact role of jemalloc_prefork and
> jemalloc_postfork. But now that postfork has a different code for parent
> and child, and since there is no such distinction in the zone allocator,
> I guess what should happen is for jemalloc to check if the pid of the
> process in postfork is the same as the one it saw during prefork, and
> dispatch to postfork_child or postfork_parent accordingly.
In practice, most mutex implementations can safely be unlocked in the child rather than being reinitialized, so I think it's okay to just use the parent version of the function here.
More information about the jemalloc-discuss