tcmalloc: Use futex syscall in SpinLockDelay() for ARM.
SpinLockDelay() was avoiding using futex() when compiled for ARM.
The alternative implementation was sleeping for 2 ms. This caused
performance issues in Telemetry's SvgCubics benchmark. The score for
this benchmark more than doubles when this patch is applied (scores were
measured on veyron_jerry, veyron_minnie, daisy). Other benchmarks
(blink_perf.bindings/post-message, blink_perf.canvas/draw-static-webgl-
to-hw-accelerated-canvas-2d) benefit from this change to a lesser
extent. This patch also removes a reference to futex1 in a comment in
linux-syscall_support.h, as this is not a valid syscall name.
Note that a similar fix was pushed in the upstream version of tcmalloc
(issue-693, https://github.com/gperftools/gperftools/commit/7df7f14).
BUG=
Change-Id: I390ac51ed5e1b0ad021ac63eaf3bce81cdca8599
Committed: https://crrev.com/7f1336053e39737671a52ca7a265007e9024ee8a
Review-Url: https://codereview.chromium.org/2457473003
Cr-Original-Commit-Position: refs/heads/master@{#437099}
Cr-Original-Original-Commit-Position: refs/heads/master@{#432628}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: e787102a66a74471263456e204209ea6b29e2d53
diff --git a/src/base/linux_syscall_support.h b/src/base/linux_syscall_support.h
index bdbc4b7..b29ec2d 100644
--- a/src/base/linux_syscall_support.h
+++ b/src/base/linux_syscall_support.h
@@ -82,7 +82,6 @@
* sys_fcntl(
* sys_fstat(
* sys_futex(
- * sys_futex1(
* sys_getcpu(
* sys_getdents(
* sys_getppid(
diff --git a/src/base/spinlock_linux-inl.h b/src/base/spinlock_linux-inl.h
index 4a1498d..2f2ca47 100644
--- a/src/base/spinlock_linux-inl.h
+++ b/src/base/spinlock_linux-inl.h
@@ -61,13 +61,8 @@
int x = 0;
// futexes are ints, so we can use them only when
// that's the same size as the lockword_ in SpinLock.
-#ifdef __arm__
- // ARM linux doesn't support sys_futex1(void*, int, int, struct timespec*);
- have_futex = 0;
-#else
have_futex = (sizeof (Atomic32) == sizeof (int) &&
syscall(__NR_futex, &x, FUTEX_WAKE, 1, 0) >= 0);
-#endif
if (have_futex &&
syscall(__NR_futex, &x, FUTEX_WAKE | futex_private_flag, 1, 0) < 0) {
futex_private_flag = 0;