diff --git a/posix/Makefile b/posix/Makefile
index e34b108..f52a5e0 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -27,6 +27,7 @@ headers	:= sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h	      \
 	   getopt.h bits/getopt_core.h bits/getopt_ext.h bits/getopt_posix.h  \
 	   bits/types.h bits/typesizes.h bits/pthreadtypes.h		      \
 	   bits/pthreadtypes-arch.h bits/thread-shared-types.h		      \
+	   bits/mutex-internal.h					      \
 	   bits/posix1_lim.h bits/posix2_lim.h bits/posix_opt.h		      \
 	   bits/local_lim.h tar.h bits/utsname.h bits/confname.h	      \
 	   bits/waitflags.h bits/waitstatus.h sys/unistd.h sched.h	      \
diff --git a/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h b/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h
index 9ab23d0..7cf45f0 100644
--- a/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h
@@ -41,13 +41,6 @@
 #define __SIZEOF_PTHREAD_COND_T         48
 #define __SIZEOF_PTHREAD_RWLOCKATTR_T	8
 
-/* Definitions for internal mutex struct.  */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION	0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  0
-#define __PTHREAD_MUTEX_USE_UNION          0
-
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
 
diff --git a/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h b/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h
index 429df10..0d6d7e6 100644
--- a/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h
@@ -29,13 +29,6 @@
 #define __SIZEOF_PTHREAD_BARRIER_T	32
 #define __SIZEOF_PTHREAD_BARRIERATTR_T	4
 
-/* Definitions for internal mutex struct.  */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION    0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  0
-#define __PTHREAD_MUTEX_USE_UNION          0
-
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
 
diff --git a/sysdeps/arm/nptl/bits/mutex-internal.h b/sysdeps/arm/nptl/bits/mutex-internal.h
new file mode 100644
index 0000000..fc00ebf
--- /dev/null
+++ b/sysdeps/arm/nptl/bits/mutex-internal.h
@@ -0,0 +1,44 @@
+/* ARM internal mutex struct definitions.
+   Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+struct __pthread_mutex_s
+{
+  int __lock;
+  unsigned int __count;
+  int __owner;
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility with static initializers.  */
+  int __kind;
+  unsigned int __nusers;
+  __extension__ union
+  {
+    int __spins;
+    __pthread_slist_t __list;
+  };
+};
+
+#define __PTHREAD_MUTEX_LOCK_ELISION       0
+#define __PTHREAD_MUTEX_HAVE_PREV          0
+
+#define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+  0, 0, 0, __kind, 0, { 0 }
+
+#endif
diff --git a/sysdeps/arm/nptl/bits/pthreadtypes-arch.h b/sysdeps/arm/nptl/bits/pthreadtypes-arch.h
index 3911c81..ffd8de3 100644
--- a/sysdeps/arm/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/arm/nptl/bits/pthreadtypes-arch.h
@@ -30,13 +30,6 @@
 #define __SIZEOF_PTHREAD_BARRIER_T 20
 #define __SIZEOF_PTHREAD_BARRIERATTR_T 4
 
-/* Data structure for mutex handling. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION    0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  1
-#define __PTHREAD_MUTEX_USE_UNION          1
-
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
 
diff --git a/sysdeps/hppa/nptl/bits/mutex-internal.h b/sysdeps/hppa/nptl/bits/mutex-internal.h
new file mode 100644
index 0000000..3368375
--- /dev/null
+++ b/sysdeps/hppa/nptl/bits/mutex-internal.h
@@ -0,0 +1,54 @@
+/* HPPA internal mutex struct definitions.
+   Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+struct __pthread_mutex_s
+{
+  int __lock __LOCK_ALIGNMENT;
+  unsigned int __count;
+  int __owner;
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility with static initializers.  */
+  int __kind;
+  /* The old 4-word 16-byte aligned lock. This is initalized
+     to all ones by the Linuxthreads PTHREAD_MUTEX_INITIALIZER.
+     Unused in NPTL.  */
+  int __glibc_compat_padding[4];
+  /* In the old structure there are 4 words left due to alignment.
+     In NPTL two words are used.  */
+  unsigned int __nusers;
+  __extension__ union
+  {
+    int __spins;
+    __pthread_slist_t __list;
+  };
+  /* Two more words are left before the NPTL
+     pthread_mutex_t is larger than Linuxthreads.  */
+  int __glibc_reserved1;
+  int __glibc_reserved2;
+};
+
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+#define __PTHREAD_MUTEX_HAVE_PREV       0
+
+#define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+  0, 0, 0, __kind, { 0, 0, 0, 0 }, 0, { 0 }, 0, 0
+
+#endif
diff --git a/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h b/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
index 865a14e..cf9399d 100644
--- a/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
@@ -40,17 +40,6 @@
 #define __SIZEOF_PTHREAD_RWLOCK_T 64
 #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
 
-/* The old 4-word 16-byte aligned lock. This is initalized
-   to all ones by the Linuxthreads PTHREAD_MUTEX_INITIALIZER.
-   Unused in NPTL.  */
-#define __PTHREAD_COMPAT_PADDING_MID  int __compat_padding[4];
-/* Two more words are left before the NPTL
-   pthread_mutex_t is larger than Linuxthreads.  */
-#define __PTHREAD_COMPAT_PADDING_END  int __reserved[2];
-#define __PTHREAD_MUTEX_LOCK_ELISION    0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  1
-#define __PTHREAD_MUTEX_USE_UNION          1
-
 #define __LOCK_ALIGNMENT __attribute__ ((__aligned__(16)))
 #define __ONCE_ALIGNMENT
 
diff --git a/sysdeps/ia64/nptl/bits/mutex-internal.h b/sysdeps/ia64/nptl/bits/mutex-internal.h
new file mode 100644
index 0000000..aef672d
--- /dev/null
+++ b/sysdeps/ia64/nptl/bits/mutex-internal.h
@@ -0,0 +1,41 @@
+/* Default internal mutex struct definitions.  ia64 version.
+   Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+struct __pthread_mutex_s
+{
+  int __lock;
+  unsigned int __count;
+  int __owner;
+  unsigned int __nusers;
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility with static initializers.  */
+  int __kind;
+  int __spins;
+  __pthread_list_t __list;
+};
+
+#define __PTHREAD_MUTEX_HAVE_PREV       1
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+#define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+  0, 0, 0, 0, __kind, 0, { 0, 0 }
+
+#endif
diff --git a/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h b/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h
index 2a3bc75..42c71af 100644
--- a/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h
@@ -29,13 +29,6 @@
 #define __SIZEOF_PTHREAD_BARRIER_T 32
 #define __SIZEOF_PTHREAD_BARRIERATTR_T 4
 
-/* Definitions for internal mutex struct.  */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION    0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  0
-#define __PTHREAD_MUTEX_USE_UNION          0
-
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
 
diff --git a/sysdeps/m68k/nptl/bits/mutex-internal.h b/sysdeps/m68k/nptl/bits/mutex-internal.h
new file mode 100644
index 0000000..ebfd0ab
--- /dev/null
+++ b/sysdeps/m68k/nptl/bits/mutex-internal.h
@@ -0,0 +1,44 @@
+/* m68k internal mutex struct definitions.
+   Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+struct __pthread_mutex_s
+{
+  int __lock __LOCK_ALIGNMENT;
+  unsigned int __count;
+  int __owner;
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility with static initializers.  */
+  int __kind;
+  unsigned int __nusers;
+  __extension__ union
+  {
+    int __spins;
+    __pthread_slist_t __list;
+  };
+};
+
+#define __PTHREAD_MUTEX_LOCK_ELISION       0
+#define __PTHREAD_MUTEX_HAVE_PREV          0
+
+#define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+  0, 0, 0, __kind, 0, { 0 }
+
+#endif
diff --git a/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h b/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h
index 966cc75..7ff98fe 100644
--- a/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h
@@ -31,13 +31,6 @@
 #define __SIZEOF_PTHREAD_BARRIER_T 20
 #define __SIZEOF_PTHREAD_BARRIERATTR_T 4
 
-/* Data structure for mutex handling. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION    0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  1
-#define __PTHREAD_MUTEX_USE_UNION          1
-
 #define __LOCK_ALIGNMENT __attribute__ ((__aligned__ (4)))
 #define __ONCE_ALIGNMENT __attribute__ ((__aligned__ (4)))
 
diff --git a/sysdeps/microblaze/nptl/bits/mutex-internal.h b/sysdeps/microblaze/nptl/bits/mutex-internal.h
new file mode 100644
index 0000000..98fda1a
--- /dev/null
+++ b/sysdeps/microblaze/nptl/bits/mutex-internal.h
@@ -0,0 +1,43 @@
+/* Microblaze internal mutex struct definitions.
+   Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+struct __pthread_mutex_s
+{
+  int __lock;
+  unsigned int __count;
+  int __owner;
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility with static initializers.  */
+  int __kind;
+  unsigned int __nusers;
+  __extension__ union
+  {
+    int __spins;
+    __pthread_slist_t __list;
+  };
+};
+#define __PTHREAD_MUTEX_HAVE_PREV          0
+#define __PTHREAD_MUTEX_LOCK_ELISION       0
+
+#define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+  0, 0, 0, __kind, 0, { 0 }
+
+#endif
diff --git a/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h b/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h
index e44f2dc..b69feaa 100644
--- a/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h
@@ -31,13 +31,6 @@
 # define __SIZEOF_PTHREAD_BARRIER_T      20
 # define __SIZEOF_PTHREAD_BARRIERATTR_T   4
 
-/* Definitions for internal mutex struct.  */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION    0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  1
-#define __PTHREAD_MUTEX_USE_UNION          1
-
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
 
diff --git a/sysdeps/mips/nptl/bits/mutex-internal.h b/sysdeps/mips/nptl/bits/mutex-internal.h
new file mode 100644
index 0000000..f76a19a
--- /dev/null
+++ b/sysdeps/mips/nptl/bits/mutex-internal.h
@@ -0,0 +1,58 @@
+/* MIPS internal mutex struct definitions.
+   Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+struct __pthread_mutex_s
+{
+  int __lock;
+  unsigned int __count;
+  int __owner;
+#if _MIPS_SIM == _ABI64
+  unsigned int __nusers;
+#endif
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility with static initializers.  */
+  int __kind;
+#if _MIPS_SIM == _ABI64
+  int __spins;
+  __pthread_list_t __list;
+# define __PTHREAD_MUTEX_HAVE_PREV      1
+#else
+  unsigned int __nusers;
+  __extension__ union
+  {
+    int __spins;
+    __pthread_slist_t __list;
+  };
+# define __PTHREAD_MUTEX_HAVE_PREV      0
+#endif
+};
+
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+#if _MIPS_SIM == _ABI64
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+  0, 0, 0, 0, __kind, 0, { 0, 0 }
+#else
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+  0, 0, 0, __kind, 0, { 0 }
+#endif
+
+#endif
diff --git a/sysdeps/nios2/nptl/bits/mutex-internal.h b/sysdeps/nios2/nptl/bits/mutex-internal.h
new file mode 100644
index 0000000..5b53f07
--- /dev/null
+++ b/sysdeps/nios2/nptl/bits/mutex-internal.h
@@ -0,0 +1,44 @@
+/* NIOS2 internal mutex struct definitions.
+   Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+struct __pthread_mutex_s
+{
+  int __lock;
+  unsigned int __count;
+  int __owner;
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility with static initializers.  */
+  int __kind;
+  unsigned int __nusers;
+  __extension__ union
+  {
+    int __spins;
+    __pthread_slist_t __list;
+  };
+};
+
+#define __PTHREAD_MUTEX_LOCK_ELISION       0
+#define __PTHREAD_MUTEX_HAVE_PREV          0
+
+#define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+  0, 0, 0, __kind, 0, { 0 }
+
+#endif
diff --git a/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h b/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h
index 83f8684..18ea235 100644
--- a/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h
@@ -31,13 +31,6 @@
 #define __SIZEOF_PTHREAD_BARRIER_T 20
 #define __SIZEOF_PTHREAD_BARRIERATTR_T 4
 
-/* Data structure for mutex handling. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION    0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  1
-#define __PTHREAD_MUTEX_USE_UNION          1
-
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
 
diff --git a/sysdeps/nptl/bits/mutex-internal.h b/sysdeps/nptl/bits/mutex-internal.h
new file mode 100644
index 0000000..ca938e7
--- /dev/null
+++ b/sysdeps/nptl/bits/mutex-internal.h
@@ -0,0 +1,43 @@
+/* Default internal mutex struct definitions.  Linux version.
+   Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+/* This is the default defines for the 'struct __pthread_mutex_s' layout,
+   used for POSIX pthread_mutex_t definition.  New ports are expected to
+   used the default layout.  The struct will have size of 32 on LP32 and
+   40 on LP64.  */
+
+struct __pthread_mutex_s
+{
+   int __lock;
+   unsigned int __count;
+   int __owner;
+   unsigned int __nusers;
+   int __kind;
+   int __spins;
+   __pthread_list_t __list;
+};
+
+#define __PTHREAD_MUTEX_HAVE_PREV         1
+#define __PTHREAD_MUTEX_LOCK_ELISION      0
+#define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+  0, 0, 0, 0, __kind, 0, { 0, 0 }
+
+#endif
diff --git a/sysdeps/nptl/bits/thread-shared-types.h b/sysdeps/nptl/bits/thread-shared-types.h
index da4358a..5bfd54e 100644
--- a/sysdeps/nptl/bits/thread-shared-types.h
+++ b/sysdeps/nptl/bits/thread-shared-types.h
@@ -32,36 +32,6 @@
    __SIZEOF_PTHREAD_BARRIER_T     - size of pthread_barrier_t.
    __SIZEOF_PTHREAD_BARRIERATTR_T - size of pthread_barrierattr_t.
 
-   Also, the following macros must be define for internal pthread_mutex_t
-   struct definitions (struct __pthread_mutex_s):
-
-   __PTHREAD_COMPAT_PADDING_MID   - any additional members after 'kind'
-				    and before '__spin' (for 64 bits) or
-				    '__nusers' (for 32 bits).
-   __PTHREAD_COMPAT_PADDING_END   - any additional members at the end of
-				    the internal structure.
-   __PTHREAD_MUTEX_LOCK_ELISION   - 1 if the architecture supports lock
-				    elision or 0 otherwise.
-   __PTHREAD_MUTEX_NUSERS_AFTER_KIND - control where to put __nusers.  The
-				       preferred value for new architectures
-				       is 0.
-   __PTHREAD_MUTEX_USE_UNION      - control whether internal __spins and
-				    __list will be place inside a union for
-				    linuxthreads compatibility.
-				    The preferred value for new architectures
-				    is 0.
-
-   For a new port the preferred values for the required defines are:
-
-   #define __PTHREAD_COMPAT_PADDING_MID
-   #define __PTHREAD_COMPAT_PADDING_END
-   #define __PTHREAD_MUTEX_LOCK_ELISION         0
-   #define __PTHREAD_MUTEX_NUSERS_AFTER_KIND    0
-   #define __PTHREAD_MUTEX_USE_UNION            0
-
-   __PTHREAD_MUTEX_LOCK_ELISION can be set to 1 if the hardware plans to
-   eventually support lock elision using transactional memory.
-
    The additional macro defines any constraint for the lock alignment
    inside the thread structures:
 
@@ -72,78 +42,46 @@
    __ONCE_ALIGNMENT - for pthread_once_t/once_flag definition.
 
    And finally the internal pthread_rwlock_t (struct __pthread_rwlock_arch_t)
-   must be defined.
- */
+   must be defined.  */
+
 #include <bits/pthreadtypes-arch.h>
 
+
 /* Common definition of pthread_mutex_t. */
 
-#if !__PTHREAD_MUTEX_USE_UNION
 typedef struct __pthread_internal_list
 {
   struct __pthread_internal_list *__prev;
   struct __pthread_internal_list *__next;
 } __pthread_list_t;
-#else
+
 typedef struct __pthread_internal_slist
 {
   struct __pthread_internal_slist *__next;
 } __pthread_slist_t;
-#endif
-
-/* Lock elision support.  */
-#if __PTHREAD_MUTEX_LOCK_ELISION
-# if !__PTHREAD_MUTEX_USE_UNION
-#  define __PTHREAD_SPINS_DATA	\
-  short __spins;		\
-  short __elision
-#  define __PTHREAD_SPINS             0, 0
-# else
-#  define __PTHREAD_SPINS_DATA	\
-  struct			\
-  {				\
-    short __espins;		\
-    short __eelision;		\
-  } __elision_data
-#  define __PTHREAD_SPINS         { 0, 0 }
-#  define __spins __elision_data.__espins
-#  define __elision __elision_data.__eelision
-# endif
-#else
-# define __PTHREAD_SPINS_DATA int __spins
-/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
-# define __PTHREAD_SPINS 0
-#endif
-
-struct __pthread_mutex_s
-{
-  int __lock __LOCK_ALIGNMENT;
-  unsigned int __count;
-  int __owner;
-#if !__PTHREAD_MUTEX_NUSERS_AFTER_KIND
-  unsigned int __nusers;
-#endif
-  /* KIND must stay at this position in the structure to maintain
-     binary compatibility with static initializers.  */
-  int __kind;
-  __PTHREAD_COMPAT_PADDING_MID
-#if __PTHREAD_MUTEX_NUSERS_AFTER_KIND
-  unsigned int __nusers;
-#endif
-#if !__PTHREAD_MUTEX_USE_UNION
-  __PTHREAD_SPINS_DATA;
-  __pthread_list_t __list;
-# define __PTHREAD_MUTEX_HAVE_PREV      1
-#else
-  __extension__ union
-  {
-    __PTHREAD_SPINS_DATA;
-    __pthread_slist_t __list;
-  };
-# define __PTHREAD_MUTEX_HAVE_PREV      0
-#endif
-  __PTHREAD_COMPAT_PADDING_END
-};
+
+/* Arch-specific mutex definitions.  A generic implementation is provided
+   by sysdeps/nptl/bits/mutex-internal.h.  If required, an architecture
+   can override it by defining:
+
+   1. struct __pthread_mutex_s (used on pthread_mutex_t definition).  It
+      should contain at least the internal members defined in the generic
+      version.
+
+   2. __PTHREAD_MUTEX_HAVE_PREV to either 1 if __pthread_mutex_s defines
+      the double-linked list __pthread_internal_list, or 0 if it uses
+      the single-linked list __pthread_internal_slist.  They are used on
+      robust mutex implementation and the double-linked trades memory
+      usage for a faster insertion and removal.
+
+   3. __PTHREAD_MUTEX_LOCK_ELISION to either 1 if architecture supports
+      hardware lock elision and actually uses the __elision member or
+      0 otherwise.
+
+   4. __PTHREAD_MUTEX_INITIALIZER macro used for static initialization.
+      It should initialize the mutex internal type.  */
+
+#include <bits/mutex-internal.h>
 
 
 /* Common definition of pthread_cond_t. */
diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h
index 787ac6e..d4a0aa8 100644
--- a/sysdeps/nptl/pthread.h
+++ b/sysdeps/nptl/pthread.h
@@ -84,30 +84,15 @@ enum
 #endif
 
 
-#if __PTHREAD_MUTEX_HAVE_PREV
-# define PTHREAD_MUTEX_INITIALIZER \
-  { { 0, 0, 0, 0, 0, __PTHREAD_SPINS, { 0, 0 } } }
-# ifdef __USE_GNU
-#  define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
-  { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, __PTHREAD_SPINS, { 0, 0 } } }
-#  define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
-  { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, __PTHREAD_SPINS, { 0, 0 } } }
-#  define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
-  { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, __PTHREAD_SPINS, { 0, 0 } } }
-
-# endif
-#else
-# define PTHREAD_MUTEX_INITIALIZER \
-  { { 0, 0, 0, 0, 0, { __PTHREAD_SPINS } } }
-# ifdef __USE_GNU
-#  define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
-  { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0, { __PTHREAD_SPINS } } }
-#  define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
-  { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0, { __PTHREAD_SPINS } } }
-#  define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
-  { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, 0, { __PTHREAD_SPINS } } }
-
-# endif
+#define PTHREAD_MUTEX_INITIALIZER \
+ { {  __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_DEFAULT) } }
+#ifdef __USE_GNU
+# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
+ { {  __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_RECURSIVE_NP) } }
+# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
+ { {  __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_ERRORCHECK_NP) } }
+# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
+ { {  __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_ADAPTIVE_NP) } }
 #endif
 
 
diff --git a/sysdeps/powerpc/nptl/bits/mutex-internal.h b/sysdeps/powerpc/nptl/bits/mutex-internal.h
new file mode 100644
index 0000000..0485a44
--- /dev/null
+++ b/sysdeps/powerpc/nptl/bits/mutex-internal.h
@@ -0,0 +1,64 @@
+/* PowerPC internal mutex struct definitions.
+   Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+struct __pthread_mutex_s
+{
+  int __lock;
+  unsigned int __count;
+  int __owner;
+#if __WORDSIZE == 64
+  unsigned int __nusers;
+#endif
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility with static initializers.  */
+  int __kind;
+#if __WORDSIZE == 64
+  short __spins;
+  short __elision;
+  __pthread_list_t __list;
+# define __PTHREAD_MUTEX_HAVE_PREV      1
+#else
+  unsigned int __nusers;
+  __extension__ union
+  {
+    struct
+    {
+      short __espins;
+      short __elision;
+# define __spins __elision_data.__espins
+# define __elision __elision_data.__elision
+    } __elision_data;
+    __pthread_slist_t __list;
+  };
+# define __PTHREAD_MUTEX_HAVE_PREV      0
+#endif
+};
+#define __PTHREAD_MUTEX_LOCK_ELISION    1
+
+#if __WORDSIZE == 64
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+  0, 0, 0, 0, __kind, 0, 0, { 0, 0 }
+#else
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+  0, 0, 0, __kind, 0, { { 0, 0 } }
+#endif
+
+#endif
diff --git a/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h b/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h
index 8158cb5..3a1680a 100644
--- a/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h
@@ -38,13 +38,6 @@
 #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
 #define __SIZEOF_PTHREAD_BARRIERATTR_T 4
 
-/* Definitions for internal mutex struct.  */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION    1
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  (__WORDSIZE != 64)
-#define __PTHREAD_MUTEX_USE_UNION          (__WORDSIZE != 64)
-
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
 
diff --git a/sysdeps/s390/nptl/bits/mutex-internal.h b/sysdeps/s390/nptl/bits/mutex-internal.h
new file mode 100644
index 0000000..f3549bd
--- /dev/null
+++ b/sysdeps/s390/nptl/bits/mutex-internal.h
@@ -0,0 +1,65 @@
+/* S390 internal mutex struct definitions.
+   Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+struct __pthread_mutex_s
+{
+  int __lock;
+  unsigned int __count;
+  int __owner;
+#if __WORDSIZE == 64
+  unsigned int __nusers;
+#endif
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility with static initializers.  */
+  int __kind;
+#if __WORDSIZE == 64
+  short __spins;
+  short __elision;
+  __pthread_list_t __list;
+# define __PTHREAD_MUTEX_HAVE_PREV      1
+#else
+  unsigned int __nusers;
+  __extension__ union
+  {
+    struct
+    {
+      short __espins;
+      short __elision;
+    } _d;
+#  define __spins _d.__espins
+#  define __elision _d.__elision
+    __pthread_slist_t __list;
+  };
+# define __PTHREAD_MUTEX_HAVE_PREV      0
+#endif
+};
+
+#define __PTHREAD_MUTEX_LOCK_ELISION    1
+
+#if __WORDSIZE == 64
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+  0, 0, 0, 0, __kind, 0, 0, { 0, 0 }
+#else
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+  0, 0, 0, __kind, 0, { { 0, 0 } }
+#endif
+
+#endif
diff --git a/sysdeps/s390/nptl/bits/pthreadtypes-arch.h b/sysdeps/s390/nptl/bits/pthreadtypes-arch.h
index fd15931..6ff0f12 100644
--- a/sysdeps/s390/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/s390/nptl/bits/pthreadtypes-arch.h
@@ -37,13 +37,6 @@
 #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
 #define __SIZEOF_PTHREAD_BARRIERATTR_T 4
 
-/* Definitions for internal mutex struct.  */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION    1
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  (__WORDSIZE != 64)
-#define __PTHREAD_MUTEX_USE_UNION          (__WORDSIZE != 64)
-
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
 
diff --git a/sysdeps/sh/nptl/bits/mutex-internal.h b/sysdeps/sh/nptl/bits/mutex-internal.h
new file mode 100644
index 0000000..83acf27
--- /dev/null
+++ b/sysdeps/sh/nptl/bits/mutex-internal.h
@@ -0,0 +1,43 @@
+/* SH internal mutex struct definitions.
+   Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+struct __pthread_mutex_s
+{
+  int __lock;
+  unsigned int __count;
+  int __owner;
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility with static initializers.  */
+  int __kind;
+  unsigned int __nusers;
+  __extension__ union
+  {
+    int __spins;
+    __pthread_slist_t __list;
+  };
+};
+#define __PTHREAD_MUTEX_LOCK_ELISION       0
+#define __PTHREAD_MUTEX_HAVE_PREV          0
+
+#define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+  0, 0, 0, __kind, 0, { 0 }
+
+#endif
diff --git a/sysdeps/sh/nptl/bits/pthreadtypes-arch.h b/sysdeps/sh/nptl/bits/pthreadtypes-arch.h
index e707751..ca28010 100644
--- a/sysdeps/sh/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/sh/nptl/bits/pthreadtypes-arch.h
@@ -30,13 +30,6 @@
 #define __SIZEOF_PTHREAD_BARRIER_T 20
 #define __SIZEOF_PTHREAD_BARRIERATTR_T 4
 
-/* Definitions for internal mutex struct.  */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION    0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  1
-#define __PTHREAD_MUTEX_USE_UNION          1
-
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
 
diff --git a/sysdeps/sparc/nptl/bits/mutex-internal.h b/sysdeps/sparc/nptl/bits/mutex-internal.h
new file mode 100644
index 0000000..265a067
--- /dev/null
+++ b/sysdeps/sparc/nptl/bits/mutex-internal.h
@@ -0,0 +1,59 @@
+/* SPARC internal mutex struct definitions.
+   Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+struct __pthread_mutex_s
+{ 
+  int __lock;
+  unsigned int __count;
+  int __owner;
+#if __WORDSIZE == 64
+  unsigned int __nusers;
+#endif
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility with static initializers.  */
+  int __kind;
+#if __WORDSIZE == 64
+  int __spins;
+  __pthread_list_t __list;
+# define __PTHREAD_MUTEX_HAVE_PREV      1
+#else
+  unsigned int __nusers;
+  __extension__ union
+  {
+    int __spins;
+    __pthread_slist_t __list;
+  };
+# define __PTHREAD_MUTEX_HAVE_PREV      0
+#endif
+};
+
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+
+#if __WORDSIZE == 64
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+  0, 0, 0, 0, __kind, 0, { 0, 0 }
+#else
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+  0, 0, 0, __kind, 0, { 0 }
+#endif
+
+#endif
diff --git a/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h b/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h
index 0f96f37..92f1ae2 100644
--- a/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h
@@ -39,13 +39,6 @@
 #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
 #define __SIZEOF_PTHREAD_BARRIERATTR_T 4
 
-/* Definitions for internal mutex struct.  */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION    0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  (__WORDSIZE != 64)
-#define __PTHREAD_MUTEX_USE_UNION          (__WORDSIZE != 64)
-
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
 
diff --git a/sysdeps/tile/nptl/bits/mutex-internal.h b/sysdeps/tile/nptl/bits/mutex-internal.h
new file mode 100644
index 0000000..253873d
--- /dev/null
+++ b/sysdeps/tile/nptl/bits/mutex-internal.h
@@ -0,0 +1,57 @@
+/* Microblaze internal mutex struct definitions.
+   Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+struct __pthread_mutex_s
+{ 
+  int __lock;
+  unsigned int __count;
+  int __owner;
+#if __WORDSIZE == 64
+  unsigned int __nusers;
+#endif
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility with static initializers.  */
+  int __kind;
+#if __WORDSIZE == 64
+  int __spins;
+  __pthread_list_t __list;
+# define __PTHREAD_MUTEX_HAVE_PREV      1
+#else
+  unsigned int __nusers;
+  __extension__ union
+  {
+    int __spins;
+    __pthread_slist_t __list;
+  };
+# define __PTHREAD_MUTEX_HAVE_PREV      0
+#endif
+};
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+#if __WORDSIZE == 64
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+  0, 0, 0, 0, __kind, 0, { 0, 0 }
+#else
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+  0, 0, 0, __kind, 0, { 0 }
+#endif
+
+#endif
diff --git a/sysdeps/tile/nptl/bits/pthreadtypes-arch.h b/sysdeps/tile/nptl/bits/pthreadtypes-arch.h
index 054474f..fef6176 100644
--- a/sysdeps/tile/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/tile/nptl/bits/pthreadtypes-arch.h
@@ -39,13 +39,6 @@
 #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
 #define __SIZEOF_PTHREAD_BARRIERATTR_T 4
 
-/* Data structure for mutex handling. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION    0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  (__WORDSIZE != 64)
-#define __PTHREAD_MUTEX_USE_UNION          (__WORDSIZE != 64)
-
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
 
diff --git a/sysdeps/unix/sysv/linux/hppa/pthread.h b/sysdeps/unix/sysv/linux/hppa/pthread.h
index 3d69ddc..4f01670 100644
--- a/sysdeps/unix/sysv/linux/hppa/pthread.h
+++ b/sysdeps/unix/sysv/linux/hppa/pthread.h
@@ -85,17 +85,14 @@ enum
 
 
 #define PTHREAD_MUTEX_INITIALIZER \
-  { { 0, 0, 0, 0, { 0, 0, 0, 0 }, 0, { __PTHREAD_SPINS }, { 0, 0 } } }
+ { {  __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_DEFAULT) } }
 #ifdef __USE_GNU
 # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
-  { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, { 0, 0, 0, 0 }, 0, \
-      { __PTHREAD_SPINS }, { 0, 0 } } }
+ { {  __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_RECURSIVE_NP) } }
 # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
-  { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, { 0, 0, 0, 0 }, 0, \
-      { __PTHREAD_SPINS }, { 0, 0 } } }
+ { {  __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_ERRORCHECK_NP) } }
 # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
-  { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, { 0, 0, 0, 0 }, 0, \
-      { __PTHREAD_SPINS }, { 0, 0 } } }
+ { {  __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_ADAPTIVE_NP) } }
 #endif
 
 
diff --git a/sysdeps/x86/nptl/bits/mutex-internal.h b/sysdeps/x86/nptl/bits/mutex-internal.h
new file mode 100644
index 0000000..4f54d4d
--- /dev/null
+++ b/sysdeps/x86/nptl/bits/mutex-internal.h
@@ -0,0 +1,65 @@
+/* x86 internal mutex struct definitions.
+   Copyright (C) 2017 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
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _THREAD_MUTEX_INTERNAL_H
+#define _THREAD_MUTEX_INTERNAL_H 1
+
+struct __pthread_mutex_s
+{
+  int __lock;
+  unsigned int __count;
+  int __owner;
+#ifdef __x86_64__
+  unsigned int __nusers;
+#endif
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility with static initializers.  */
+  int __kind;
+#ifdef __x86_64__
+  short __spins;
+  short __elision;
+  __pthread_list_t __list;
+# define __PTHREAD_MUTEX_HAVE_PREV      1
+#else
+  unsigned int __nusers;
+  __extension__ union
+  {
+    struct
+    {
+      short __espins;
+      short __elision;
+# define __spins __elision_data.__espins
+# define __elision __elision_data.__elision
+# define __PTHREAD_SPINS         { 0, 0 }
+    } __elision_data;
+    __pthread_slist_t __list;
+  };
+# define __PTHREAD_MUTEX_HAVE_PREV      0
+#endif
+};
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+#ifdef __x86_64__
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+  0, 0, 0, 0, __kind, 0, 0, { 0, 0 }
+#else
+# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
+  0, 0, 0, __kind, 0, { { 0, 0 } }
+#endif
+
+#endif
diff --git a/sysdeps/x86/nptl/bits/pthreadtypes-arch.h b/sysdeps/x86/nptl/bits/pthreadtypes-arch.h
index 74d5f6d..a2c209b 100644
--- a/sysdeps/x86/nptl/bits/pthreadtypes-arch.h
+++ b/sysdeps/x86/nptl/bits/pthreadtypes-arch.h
@@ -47,18 +47,6 @@
 #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
 #define __SIZEOF_PTHREAD_BARRIERATTR_T 4
 
-/* Definitions for internal mutex struct.  */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION    1
-#ifdef __x86_64__
-# define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  0
-# define __PTHREAD_MUTEX_USE_UNION          0
-#else
-# define __PTHREAD_MUTEX_NUSERS_AFTER_KIND  1
-# define __PTHREAD_MUTEX_USE_UNION          1
-#endif
-
 #define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
 
