[PATCH] [gomp] Recycle non-nested team if possible

Jakub Jelinek jakub@redhat.com
Mon Jul 13 14:17:00 GMT 2015


On Mon, Jul 13, 2015 at 01:15:44PM +0200, Sebastian Huber wrote:
> diff --git a/libgomp/team.c b/libgomp/team.c
> index b98b233..0bcbaf8 100644
> --- a/libgomp/team.c
> +++ b/libgomp/team.c
> @@ -134,6 +134,25 @@ gomp_thread_start (void *xdata)
>    return NULL;
>  }
>  
> +static struct gomp_team *
> +get_recycable_team (unsigned nthreads)

That would be recyclable.
But I think get_last_team would be better.
Also, please make it static inline.

> +      team = gomp_malloc (sizeof (*team) + nthreads * extra);
> +
> +#ifndef HAVE_SYNC_BUILTINS
> +      gomp_mutex_init (&team->work_share_list_free_lock);
> +#endif

Avoiding gomp_mutex_destroy/gomp_mutex_init is fine,
but I must say I'm far less sure about gomp_sem_init (can you
add there a temporary assert that it has the expected value)
and even less about gomp_barrier_init (I think e.g. on Linux
generation will be very unlikely 0 that it should be, and not
sure about awaited_final value either).

	Jakub



More information about the Gcc-patches mailing list