Re: [PATCH] [libgomp] make it possible to use OMP on both sides of a fork

2014-04-15 Thread Nathaniel Smith
On Tue, Mar 4, 2014 at 11:37 PM, Nathaniel Smith wrote: > On Tue, Feb 18, 2014 at 8:58 PM, Richard Henderson wrote: >> On 02/16/2014 03:59 PM, Nathaniel Smith wrote: >>> Yes, but the problem is that depending on what the user intends to do >>> after forking, our pthread_atfork handler might help

Re: [PATCH] [libgomp] make it possible to use OMP on both sides of a fork

2014-03-04 Thread Nathaniel Smith
On Tue, Feb 18, 2014 at 8:58 PM, Richard Henderson wrote: > On 02/16/2014 03:59 PM, Nathaniel Smith wrote: >> Yes, but the problem is that depending on what the user intends to do >> after forking, our pthread_atfork handler might help or it might hurt, >> and we don't know which. Consider these t

Re: [PATCH] [libgomp] make it possible to use OMP on both sides of a fork

2014-02-18 Thread Richard Henderson
On 02/16/2014 03:59 PM, Nathaniel Smith wrote: > Yes, but the problem is that depending on what the user intends to do > after forking, our pthread_atfork handler might help or it might hurt, > and we don't know which. Consider these two cases: > - fork+exec > - fork+continue to use OMP in chil

Re: [PATCH] [libgomp] make it possible to use OMP on both sides of a fork

2014-02-16 Thread Nathaniel Smith
On Fri, Feb 14, 2014 at 3:43 AM, Jakub Jelinek wrote: > On Fri, Feb 14, 2014 at 09:21:24AM +0100, Jakub Jelinek wrote: >> Well, fork is async signal safe function, so calling malloc/free, or any >> kind of synchronization primitives is completely unsafe there. >> >> The only safe thing could be to

Re: [PATCH] [libgomp] make it possible to use OMP on both sides of a fork

2014-02-16 Thread Nathaniel Smith
On Fri, Feb 14, 2014 at 3:14 PM, Richard Henderson wrote: > On 02/14/2014 12:21 AM, Jakub Jelinek wrote: >>> Any reason not to just run gomp_free_thread_pool from >>> gomp_after_fork_callback >>> directly? I see no restrictions on what kind of code is allowed to execute >>> during that callback.

Re: [PATCH] [libgomp] make it possible to use OMP on both sides of a fork

2014-02-14 Thread Richard Henderson
On 02/14/2014 12:21 AM, Jakub Jelinek wrote: >> Any reason not to just run gomp_free_thread_pool from >> gomp_after_fork_callback >> directly? I see no restrictions on what kind of code is allowed to execute >> during that callback. > > Well, fork is async signal safe function, so calling malloc

Re: [PATCH] [libgomp] make it possible to use OMP on both sides of a fork

2014-02-14 Thread Jakub Jelinek
On Fri, Feb 14, 2014 at 09:21:24AM +0100, Jakub Jelinek wrote: > Well, fork is async signal safe function, so calling malloc/free, or any > kind of synchronization primitives is completely unsafe there. > > The only safe thing could be to atomically or in some global flag (or set > some TLS flag?)

Re: [PATCH] [libgomp] make it possible to use OMP on both sides of a fork

2014-02-14 Thread Jakub Jelinek
On Thu, Feb 13, 2014 at 01:22:41PM -0800, Richard Henderson wrote: > > +/* This is to enable best-effort cleanup after fork. */ > > +static int gomp_we_are_forked = 0; > > bool, no explicit initialization, possible removal, see below. > > > +static void > > +gomp_free_thread_pool (int threads_ru

Re: [PATCH] [libgomp] make it possible to use OMP on both sides of a fork

2014-02-13 Thread Richard Henderson
> +/* This is to enable best-effort cleanup after fork. */ > +static int gomp_we_are_forked = 0; bool, no explicit initialization, possible removal, see below. > +static void > +gomp_free_thread_pool (int threads_running) bool for threads_running. It looks like a count otherwise. > +gomp_afte