This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] malloc: Remove malloc hooks from fork handler


LGTM with one question.

On Wed, 2016-02-10 at 22:48 +0100, Florian Weimer wrote:
> @@ -206,63 +137,30 @@ static unsigned int atfork_recursive_cntr;
>  void
>  __malloc_fork_lock_parent (void)
>  {
> -  mstate ar_ptr;
> -
>    if (__malloc_initialized < 1)
>      return;
>  
>    /* We do not acquire free_list_lock here because we completely
>       reconstruct free_list in __malloc_fork_unlock_child.  */
>  
> -  if (mutex_trylock (&list_lock))
> -    {
> -      if (thread_arena == ATFORK_ARENA_PTR)
> -        /* This is the same thread which already locks the global list.
> -           Just bump the counter.  */
> -        goto out;
> +  (void) mutex_lock (&list_lock);

Is it obvious why the recursive case that the previous code tried to
handle can't happen anymore?  If not, a comment might be useful.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]