unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Florian Weimer <fweimer@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH 3/3] Refactor atfork handlers
Date: Tue, 20 Feb 2018 10:27:45 -0300	[thread overview]
Message-ID: <780cefa6-543f-1a04-4b4e-9059a30d211b@linaro.org> (raw)
In-Reply-To: <9d8251a8-7604-9846-ebde-409786e2ebf4@redhat.com>



On 20/02/2018 10:05, Florian Weimer wrote:
> On 02/20/2018 02:00 PM, Adhemerval Zanella wrote:
>> The temporary copy is problematic because we either need to allocate on the stack using
>> vla/alloca (current practice and prone of stack overflow) or by malloc (which requires
>> locking anyway).  Also, to temporary copy we will need pretty much the same lock-free
>> algorithm which adds code complexity.
> 
> I think the lock in malloc is fine, at least for the time being, with our non-async-safe fork.
> 
> The point is not avoiding the lock, but callbacks when the lock is held.  This can easily result in deadlocks.

I think it might occur with proposed implementation only if a callback tries to call
pthread_atfork or fork itself.  It these scenario you have in mind? And should we
really support them if this is the case?


> 
>> My understanding is current algorithm tries hard to remove any locking on fork generation
>> mainly because back then posix_spawn was no specified and suboptimal. Now that we have
>> a faster way to spawn process in multithread environment I think there is no much gain
>> in trying to optimizing locking in atfork handlers.
> 
> I think it's also needed to avoid deadlocks .
> 
>> Regarding the handler running in child process the proposed implementation does implement
>> it.
> 
> I don't see how?  I meant that only those handlers run that ran in the parent.  I think there's a window where more fork handlers can be added.
>


  reply	other threads:[~2018-02-20 13:25 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-07 13:09 [PATCH 1/3] Refactor Linux ARCH_FORK implementation Adhemerval Zanella
2018-02-07 13:09 ` [PATCH 2/3] dynarray: Implement remove function Adhemerval Zanella
2018-02-07 14:48   ` Alexander Monakov
2018-02-07 16:06     ` Adhemerval Zanella
2018-02-07 13:09 ` [PATCH 3/3] Refactor atfork handlers Adhemerval Zanella
2018-02-07 15:07   ` Florian Weimer
2018-02-07 17:16     ` Adhemerval Zanella
2018-02-08  8:32       ` Florian Weimer
2018-02-08 12:50         ` Adhemerval Zanella
2018-02-20 11:29           ` Florian Weimer
2018-02-20 13:00             ` Adhemerval Zanella
2018-02-20 13:05               ` Florian Weimer
2018-02-20 13:27                 ` Adhemerval Zanella [this message]
2018-02-20 13:42                   ` Florian Weimer
2018-02-20 13:48                     ` Adhemerval Zanella
2018-02-20 13:58                       ` Florian Weimer
2018-02-20 14:23                         ` Adhemerval Zanella
2018-02-23 10:41                           ` Florian Weimer
2018-02-23 12:10                             ` Adhemerval Zanella
2018-02-27  8:25                               ` Florian Weimer
2018-03-07 16:51 ` [PATCH 1/3] Refactor Linux ARCH_FORK implementation Adhemerval Zanella
2018-03-08 12:05 ` Florian Weimer
2018-03-08 12:58   ` Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=780cefa6-543f-1a04-4b4e-9059a30d211b@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).