Accepting request 146470 from home:k0da:ppc
- spinlock-rand.patch fixes an issue encountered on PPC with undefined conversions from 'base::subtle::Atomic64*' to 'const volatile Atomic32*' OBS-URL: https://build.opensuse.org/request/show/146470 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/gperftools?expand=0&rev=13
This commit is contained in:
parent
06ebd4bc3a
commit
6ed2b425af
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Dec 27 11:08:09 UTC 2012 - dvaleev@suse.com
|
||||||
|
|
||||||
|
- spinlock-rand.patch fixes an issue encountered on PPC with
|
||||||
|
undefined conversions from 'base::subtle::Atomic64*' to 'const
|
||||||
|
volatile Atomic32*'
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sun Jul 22 07:47:04 UTC 2012 - aj@suse.de
|
Sun Jul 22 07:47:04 UTC 2012 - aj@suse.de
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ Patch11: %{name}_fix_multiple_install_headers.patch
|
|||||||
Patch12: %{name}_fix_unassigned_malloc_in_unittest.patch
|
Patch12: %{name}_fix_unassigned_malloc_in_unittest.patch
|
||||||
Patch14: %{name}_gcc46.patch
|
Patch14: %{name}_gcc46.patch
|
||||||
Patch15: %{name}-glibc216.patch
|
Patch15: %{name}-glibc216.patch
|
||||||
|
Patch16: spinlock-rand.patch
|
||||||
BuildRequires: autoconf
|
BuildRequires: autoconf
|
||||||
BuildRequires: automake
|
BuildRequires: automake
|
||||||
BuildRequires: gcc-c++
|
BuildRequires: gcc-c++
|
||||||
@ -67,6 +68,7 @@ files for developing applications that use the gperftools package.
|
|||||||
%patch12 -p1
|
%patch12 -p1
|
||||||
%patch14 -p1
|
%patch14 -p1
|
||||||
%patch15 -p1
|
%patch15 -p1
|
||||||
|
%patch16 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
autoreconf -fi
|
autoreconf -fi
|
||||||
|
37
spinlock-rand.patch
Normal file
37
spinlock-rand.patch
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
diff --git a/src/base/spinlock_internal.cc b/src/base/spinlock_internal.cc
|
||||||
|
index b9fadde..172a637 100644
|
||||||
|
--- a/src/base/spinlock_internal.cc
|
||||||
|
+++ b/src/base/spinlock_internal.cc
|
||||||
|
@@ -80,6 +80,7 @@ int32 SpinLockWait(volatile Atomic32 *w, int n,
|
||||||
|
static int SuggestedDelayNS(int loop) {
|
||||||
|
// Weak pseudo-random number generator to get some spread between threads
|
||||||
|
// when many are spinning.
|
||||||
|
+#ifdef BASE_HAS_ATOMIC64
|
||||||
|
static base::subtle::Atomic64 rand;
|
||||||
|
uint64 r = base::subtle::NoBarrier_Load(&rand);
|
||||||
|
r = 0x5deece66dLL * r + 0xb; // numbers from nrand48()
|
||||||
|
@@ -96,6 +97,24 @@ static int SuggestedDelayNS(int loop) {
|
||||||
|
// The futex path multiplies this by 16, since we expect explicit wakeups
|
||||||
|
// almost always on that path.
|
||||||
|
return r >> (44 - (loop >> 3));
|
||||||
|
+#else
|
||||||
|
+ static Atomic32 rand;
|
||||||
|
+ uint32 r = base::subtle::NoBarrier_Load(&rand);
|
||||||
|
+ r = 0x343fd * r + 0x269ec3; // numbers from MSVC++
|
||||||
|
+ base::subtle::NoBarrier_Store(&rand, r);
|
||||||
|
+
|
||||||
|
+ r <<= 1; // 31-bit random number now in top 31-bits.
|
||||||
|
+ if (loop < 0 || loop > 32) { // limit loop to 0..32
|
||||||
|
+ loop = 32;
|
||||||
|
+ }
|
||||||
|
+ // loop>>3 cannot exceed 4 because loop cannot exceed 32.
|
||||||
|
+ // Select top 20..24 bits of lower 31 bits,
|
||||||
|
+ // giving approximately 0ms to 16ms.
|
||||||
|
+ // Mean is exponential in loop for first 32 iterations, then 8ms.
|
||||||
|
+ // The futex path multiplies this by 16, since we expect explicit wakeups
|
||||||
|
+ // almost always on that path.
|
||||||
|
+ return r >> (12 - (loop >> 3));
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace internal
|
Loading…
x
Reference in New Issue
Block a user