From 5a414ff70c3a45e52b5f5c0741bd459a84cf56b8 Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Fri, 9 May 2014 16:58:46 +0200 Subject: S/390: Port of lock elision to System/z Added support for TX lock elision of pthread mutexes on s390 and s390x. This may improve lock scaling of existing programs on TX capable systems. The lock elision code is only built with --enable-lock-elision=yes and then requires a GCC version supporting the TX builtins. With lock elision default mutexes are elided via __builtin_tbegin, if the cpu supports transactions. By default lock elision is not enabled and the elision code is not built. --- nptl/sysdeps/unix/sysv/linux/s390/force-elision.h | 33 +++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 nptl/sysdeps/unix/sysv/linux/s390/force-elision.h (limited to 'nptl/sysdeps/unix/sysv/linux/s390/force-elision.h') diff --git a/nptl/sysdeps/unix/sysv/linux/s390/force-elision.h b/nptl/sysdeps/unix/sysv/linux/s390/force-elision.h new file mode 100644 index 0000000000..8fd7684d9a --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/s390/force-elision.h @@ -0,0 +1,33 @@ +/* Automatic enabling of elision for mutexes + 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 + . */ + +#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 \ + && (m->__data.__kind & PTHREAD_MUTEX_ELISION_FLAGS_NP) == 0) \ + { \ + mutex->__data.__kind |= PTHREAD_MUTEX_ELISION_NP; \ + s; \ + } +#endif -- cgit 1.4.1