This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 3/3] Add adaptive elision to rwlocks v2
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Andi Kleen <ak at linux dot intel dot com>
- Cc: Andi Kleen <andi at firstfloor dot org>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Thu, 19 Jun 2014 15:27:44 -0700
- Subject: Re: [PATCH 3/3] Add adaptive elision to rwlocks v2
- Authentication-results: sourceware.org; auth=none
- References: <1399412209-28245-1-git-send-email-andi at firstfloor dot org> <1399412209-28245-4-git-send-email-andi at firstfloor dot org> <CAMe9rOp5k3a9fpPABPnoGY-FC60q29SF-+-5ojs4tg=gb4b1MA at mail dot gmail dot com> <20140619205240 dot GY8178 at tassilo dot jf dot intel dot com>
On Thu, Jun 19, 2014 at 1:52 PM, Andi Kleen <ak@linux.intel.com> wrote:
>> This is wrong for x32. We need something like
>
> Ok. Looks good to me. I assume you'll handle it.
>
> -Andi
>
>>
>> diff --git a/sysdeps/x86/nptl/bits/pthreadtypes.h
>> b/sysdeps/x86/nptl/bits/pthreadtypes.h
>> index b04c32b..bfb9034 100644
>> --- a/sysdeps/x86/nptl/bits/pthreadtypes.h
>> +++ b/sysdeps/x86/nptl/bits/pthreadtypes.h
>> @@ -185,12 +185,17 @@ typedef union
>> int __writer;
>> int __shared;
>> signed char __rwelision;
>> +# ifdef __ILP32__
>> + unsigned char __pad1[3];
>> +# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, {0, 0, 0 }
>> +# else
>> unsigned char __pad1[7];
>> +# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, {0, 0, 0, 0, 0, 0, 0 }
>> +# endif
>> unsigned long int __pad2;
>> /* FLAGS must stay at this position in the structure to maintain
>> binary compatibility. */
>> unsigned int __flags;
>> -# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, {0, 0, 0, 0, 0, 0, 0 }
>> # define __PTHREAD_RWLOCK_INT_FLAGS_SHARED 1
>> } __data;
>> # else
>>
>>
>> H.J.
>
I am checking in this.
Thanks.
--
H.J.
----
>From c8daec5c7cd19378112391d2394e6d6344e156dc Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Thu, 19 Jun 2014 15:22:52 -0700
Subject: [PATCH] Use 3 bytes for __pad1 in pthread_rwlock_t for x32
Since long is 4 bytes for x32, we should use 3 bytes for __pad1 when
a long __pad1 is replaced by a byte __rwelision and __pad1.
* sysdeps/x86/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Use
3 bytes for __pad1 for x32.
(__PTHREAD_RWLOCK_ELISION_EXTRA): Likewise.
---
ChangeLog | 6 ++++++
sysdeps/x86/nptl/bits/pthreadtypes.h | 7 ++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 841d55e..ec08f77 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-06-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ * sysdeps/x86/nptl/bits/pthreadtypes.h (pthread_rwlock_t): Use
+ 3 bytes for __pad1 for x32.
+ (__PTHREAD_RWLOCK_ELISION_EXTRA): Likewise.
+
2014-06-19 Ling Ma <ling.ml@alibaba-inc.com>
H.J. Lu <hongjiu.lu@intel.com>
diff --git a/sysdeps/x86/nptl/bits/pthreadtypes.h
b/sysdeps/x86/nptl/bits/pthreadtypes.h
index b04c32b..7f8076b 100644
--- a/sysdeps/x86/nptl/bits/pthreadtypes.h
+++ b/sysdeps/x86/nptl/bits/pthreadtypes.h
@@ -185,12 +185,17 @@ typedef union
int __writer;
int __shared;
signed char __rwelision;
+# ifdef __ILP32__
+ unsigned char __pad1[3];
+# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0 }
+# else
unsigned char __pad1[7];
+# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0, 0, 0, 0, 0 }
+# endif
unsigned long int __pad2;
/* FLAGS must stay at this position in the structure to maintain
binary compatibility. */
unsigned int __flags;
-# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, {0, 0, 0, 0, 0, 0, 0 }
# define __PTHREAD_RWLOCK_INT_FLAGS_SHARED 1
} __data;
# else
--