From patchwork Thu Mar 20 16:12:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 332298 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C62BD2C0096 for ; Fri, 21 Mar 2014 03:12:35 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type; q=dns; s=default; b=V78d0Za3zOHslPPOdfVB7yBt9ItAF HdR9IdxfY8CJjYfafOez4ScfVadf+hU/B3ZB5yDQpgUaFHBQ6opUjy8+QT1eFQBm g4YTwqV2ZsG16egcf8YQJDqS95kK6zJQ3GRdnwoisG0u9pV5S+BIru/gjAAS8Qy3 UmgMWiA3wRRKW8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type; s=default; bh=3pRmH8eTn/nUHJpvhHDDAO9GoLY=; b=vI3 UvqKyGwQT3Peidx2JHHkSbPj3hkfKDaTPz753WdukaLMmnoW83K431IetsZaS0+M Z5wgL5+tnqotXVIvgn2blTsQ7z4zlPX0Kj6AaxbwMTJ1VYT1ilgZbL5i2lJAyCOR qSe05aBHa5B1WmqLRvOu3G4uNvRt197m1smhip48= Received: (qmail 10170 invoked by alias); 20 Mar 2014 16:12:29 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 10152 invoked by uid 89); 20 Mar 2014 16:12:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx2.suse.de From: Andreas Schwab To: libc-alpha@sourceware.org Subject: [PATCH] Skip checks in pthread_mutex_destroy when doing elision X-Yow: Yes, Private DOBERMAN!! Date: Thu, 20 Mar 2014 17:12:23 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 [BZ #16657] * nptl/pthread_mutex_destroy.c (__pthread_mutex_destroy): Skip checks when doing elision. * nptl/sysdeps/unix/sysv/linux/x86/pthread_mutex_destroy.c: New file. --- nptl/pthread_mutex_destroy.c | 6 +++++- .../unix/sysv/linux/x86/pthread_mutex_destroy.c | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 nptl/sysdeps/unix/sysv/linux/x86/pthread_mutex_destroy.c diff --git a/nptl/pthread_mutex_destroy.c b/nptl/pthread_mutex_destroy.c index 35a2dfe..f6bd6d9 100644 --- a/nptl/pthread_mutex_destroy.c +++ b/nptl/pthread_mutex_destroy.c @@ -21,6 +21,9 @@ #include +#ifndef DO_ELISION +# define DO_ELISION(m) 0 +#endif int __pthread_mutex_destroy (mutex) @@ -28,7 +31,8 @@ __pthread_mutex_destroy (mutex) { LIBC_PROBE (mutex_destroy, 1, mutex); - if ((mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP) == 0 + if (!DO_ELISION (mutex) + && (mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP) == 0 && mutex->__data.__nusers != 0) return EBUSY; diff --git a/nptl/sysdeps/unix/sysv/linux/x86/pthread_mutex_destroy.c b/nptl/sysdeps/unix/sysv/linux/x86/pthread_mutex_destroy.c new file mode 100644 index 0000000..b125f75 --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/x86/pthread_mutex_destroy.c @@ -0,0 +1,22 @@ +/* Elided version of pthread_mutex_destroy. + Copyright (C) 2014 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include "force-elision.h" + +#include "nptl/pthread_mutex_destroy.c"