From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753261AbcDCKJx (ORCPT ); Sun, 3 Apr 2016 06:09:53 -0400 Received: from www.linutronix.de ([62.245.132.108]:58676 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752716AbcDCKJw (ORCPT ); Sun, 3 Apr 2016 06:09:52 -0400 Date: Sun, 3 Apr 2016 12:08:16 +0200 (CEST) From: Thomas Gleixner To: Peter Zijlstra cc: LKML , Sebastian Andrzej Siewior , Darren Hart , Ingo Molnar , Michael Kerrisk , Davidlohr Bueso , Chris Mason , "Carlos O'Donell" , Torvald Riegel , Eric Dumazet Subject: Re: [RFC patch 7/7] [PATCH] glibc: nptl: Add support for attached pthread_mutexes In-Reply-To: <20160402163059.GS3448@twins.programming.kicks-ass.net> Message-ID: References: <20160402095108.894519835@linutronix.de> <20160402110036.173191836@linutronix.de> <20160402163059.GS3448@twins.programming.kicks-ass.net> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2 Apr 2016, Peter Zijlstra wrote: > On Sat, Apr 02, 2016 at 11:09:20AM -0000, Thomas Gleixner wrote: > > To undo the attachment each involved thread needs to call > > > > pthread_mutex_detach_np(&mutex); > > > > When the last user detaches the kernel state is destroyed. > > So I was fully expecting pthread_mutex_{at,de}tach_np() to not exist and > be internal to pthread_mutex_{init,destroy}(). > > Is there a reason this is not so? init/destroy are only called once and not on all threads using the futex. If you want to hide that, then you need to add it to all pthread_mutex_* operations and attach on the first call. That's possible, but for simplicity we made it explicit. Thanks, tglx