From patchwork Thu Sep 11 09:06:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 388166 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 A6A2B1400E9 for ; Thu, 11 Sep 2014 19:06:26 +1000 (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=dS0uvxb4v1hKt3vcD1xXRKEf3uciR GRtjPtBg24/w9OqBSoZiAst6n2oaRZj6xFOBup2G67B7M6eDI4riWzdO2YbUi6Fo mP+Ld08p6XxAs8LvUg4eToBq14ueqhnd5OQwLikhFhqbDC3YOUYgVatFyYBK8qWU I6If5/wu+yfrkk= 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=Jn8E36KAVGuvT7WEyCwfX4YB3dI=; b=F7J 0KRTyGyv57qm+kNas8YZ0PKZalXOzFHhZ3JVJN62k7kBARC55cDL4eq0mkIaKIm0 +Q4ZL6TPcqQ0ntrP+PkyYU1cAC0kxNRr0VcUFIvbA5StOTwJwXUSVMDO+EdLdmE4 AzxEXtpq7VCD3IqlgJcVtkWEZjoy8sLce2VfgYos= Received: (qmail 1737 invoked by alias); 11 Sep 2014 09:06:21 -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 1725 invoked by uid 89); 11 Sep 2014 09:06:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx2.suse.de From: Andreas Schwab To: libc-alpha@sourceware.org Subject: [PATCH] Properly handle forced elision in pthread_mutex_trylock X-Yow: I'm having a BIG BANG THEORY!! Date: Thu, 11 Sep 2014 11:06:14 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 [BZ #16657] * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock): Use FORCE_ELISION instead of DO_ELISION. * sysdeps/unix/sysv/linux/x86/force-elision.h (DO_ELISION): Remove. * sysdeps/unix/sysv/linux/s390/force-elision.h (DO_ELISION): Likewise. --- nptl/pthread_mutex_trylock.c | 7 +++---- sysdeps/unix/sysv/linux/s390/force-elision.h | 5 ----- sysdeps/unix/sysv/linux/x86/force-elision.h | 5 ----- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/nptl/pthread_mutex_trylock.c b/nptl/pthread_mutex_trylock.c index 0867b06..6c4594a 100644 --- a/nptl/pthread_mutex_trylock.c +++ b/nptl/pthread_mutex_trylock.c @@ -26,8 +26,8 @@ #define lll_trylock_elision(a,t) lll_trylock(a) #endif -#ifndef DO_ELISION -#define DO_ELISION(m) 0 +#ifndef FORCE_ELISION +#define FORCE_ELISION(m, s) #endif /* We don't force elision in trylock, because this can lead to inconsistent @@ -77,8 +77,7 @@ __pthread_mutex_trylock (mutex) return 0; case PTHREAD_MUTEX_TIMED_NP: - if (DO_ELISION (mutex)) - goto elision; + FORCE_ELISION (mutex, goto elision); /*FALL THROUGH*/ case PTHREAD_MUTEX_ADAPTIVE_NP: case PTHREAD_MUTEX_ERRORCHECK_NP: diff --git a/sysdeps/unix/sysv/linux/s390/force-elision.h b/sysdeps/unix/sysv/linux/s390/force-elision.h index 8fd7684..31b3662 100644 --- a/sysdeps/unix/sysv/linux/s390/force-elision.h +++ b/sysdeps/unix/sysv/linux/s390/force-elision.h @@ -17,11 +17,6 @@ . */ #ifdef ENABLE_LOCK_ELISION -/* Check for elision on this lock without upgrading. */ -#define DO_ELISION(m) \ - (__pthread_force_elision \ - && (m->__data.__kind & PTHREAD_MUTEX_NO_ELISION_NP) == 0) \ - /* Automatically enable elision for existing user lock kinds. */ #define FORCE_ELISION(m, s) \ if (__pthread_force_elision \ diff --git a/sysdeps/unix/sysv/linux/x86/force-elision.h b/sysdeps/unix/sysv/linux/x86/force-elision.h index 945f886..a767cf1 100644 --- a/sysdeps/unix/sysv/linux/x86/force-elision.h +++ b/sysdeps/unix/sysv/linux/x86/force-elision.h @@ -16,11 +16,6 @@ License along with the GNU C Library; if not, see . */ -/* Check for elision on this lock without upgrading. */ -#define DO_ELISION(m) \ - (__pthread_force_elision \ - && (m->__data.__kind & PTHREAD_MUTEX_NO_ELISION_NP) == 0) \ - /* Automatically enable elision for existing user lock kinds. */ #define FORCE_ELISION(m, s) \ if (__pthread_force_elision \