Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Issue 16335007: Improve the implementation of atomic operations on Linux/ARM (including Android/ARM). (Closed)

Created:
7 years, 6 months ago by digit1
Modified:
7 years, 6 months ago
CC:
chromium-reviews, erikwright+watch_chromium.org, Lei Zhang
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

Improve the implementation of atomic operations on Linux/ARM (including Android/ARM). The previous patch at: https://chromiumcodereview.appspot.com/10831358 actually regressed the performance of atomic operations on Linux/ARM systems, because the GCC intrinsics (e.g. __sync_fetch_and_add) are very poorly implemented at the moment (and also always provide a full barrier, even when the caller doesn't need it). This replaces the implementation with a better version which: - Uses inline assembly and LDRES/STREX instructions on ARMv6+, or the old kernel helper cmpxchg implementation on ARMv5. - Still uses the kernel helper memory barrier to optimize for single core devices on ARMv6 and ARMv7, or ARMv5 binaries running on devices with a higher architecture number. - Provide truly barrier free compare-and-swap, swap and atomic-inc operations. On tested Android/ARM devices, this speeds up atomic increments by x2 to x3. This indirectly speeds up other operations relying on it (e.g. scoped_refptr<> or base::Bind()). For details, see: https://docs.google.com/a/chromium.org/spreadsheet/ccc?key=0Arp73PHrzcIQdGNUd1NGYWlfY0dKWS1EZ2V6RThhZXc&usp=sharing BUG=234215 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=205205

Patch Set 1 #

Total comments: 15

Patch Set 2 : fix NaCL builds and other issues. #

Patch Set 3 : Add comment about Linux 2.6.24 #

Total comments: 11

Patch Set 4 : Really fix the NACL builds. #

Patch Set 5 : Fix Acquire_CompareAndSwap() for ARMv5 #

Total comments: 23

Patch Set 6 : Address Mark's remarks #

Total comments: 1

Patch Set 7 : Fix typo #

Patch Set 8 : Trivial rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+281 lines, -2 lines) Patch
M base/atomicops.h View 1 2 3 1 chunk +3 lines, -2 lines 0 comments Download
A base/atomicops_internals_arm_gcc.h View 1 2 3 4 5 6 1 chunk +278 lines, -0 lines 0 comments Download

Messages

Total messages: 26 (0 generated)
digit1
Here's a new implementation of atomic operations on ARM that should distinctly improve performance of ...
7 years, 6 months ago (2013-06-03 16:51:47 UTC) #1
Dmitry Vyukov
https://chromiumcodereview.appspot.com/16335007/diff/1/base/atomicops_internals_arm_gcc.h File base/atomicops_internals_arm_gcc.h (right): https://chromiumcodereview.appspot.com/16335007/diff/1/base/atomicops_internals_arm_gcc.h#newcode164 base/atomicops_internals_arm_gcc.h:164: " blx %5\n" yeah, this is very subtle the ...
7 years, 6 months ago (2013-06-03 18:01:22 UTC) #2
JF
https://chromiumcodereview.appspot.com/16335007/diff/1/base/atomicops_internals_arm_gcc.h File base/atomicops_internals_arm_gcc.h (right): https://chromiumcodereview.appspot.com/16335007/diff/1/base/atomicops_internals_arm_gcc.h#newcode49 base/atomicops_internals_arm_gcc.h:49: ((void (*)(void))LINUX_ARM_KERNEL_MEMORY_BARRIER)(); Shouldn't this have a compiler barrier to ...
7 years, 6 months ago (2013-06-03 18:29:27 UTC) #3
Lei Zhang
I defer to those who know more about ARM.
7 years, 6 months ago (2013-06-03 20:53:50 UTC) #4
Dmitry Vyukov
On Mon, Jun 3, 2013 at 10:29 PM, <jfb@chromium.org> wrote: > > https://chromiumcodereview.appspot.com/16335007/diff/1/base/atomicops_internals_arm_gcc.h > File ...
7 years, 6 months ago (2013-06-04 04:40:56 UTC) #5
digit1
https://chromiumcodereview.appspot.com/16335007/diff/1/base/atomicops_internals_arm_gcc.h File base/atomicops_internals_arm_gcc.h (right): https://chromiumcodereview.appspot.com/16335007/diff/1/base/atomicops_internals_arm_gcc.h#newcode49 base/atomicops_internals_arm_gcc.h:49: ((void (*)(void))LINUX_ARM_KERNEL_MEMORY_BARRIER)(); I believe that all function calls are ...
7 years, 6 months ago (2013-06-04 09:05:28 UTC) #6
Dmitry Vyukov
https://chromiumcodereview.appspot.com/16335007/diff/13001/base/atomicops_internals_arm_gcc.h File base/atomicops_internals_arm_gcc.h (right): https://chromiumcodereview.appspot.com/16335007/diff/13001/base/atomicops_internals_arm_gcc.h#newcode142 base/atomicops_internals_arm_gcc.h:142: : "memory"); I think that NoBarrier functions does not ...
7 years, 6 months ago (2013-06-04 09:26:00 UTC) #7
digit1
https://chromiumcodereview.appspot.com/16335007/diff/13001/base/atomicops_internals_arm_gcc.h File base/atomicops_internals_arm_gcc.h (right): https://chromiumcodereview.appspot.com/16335007/diff/13001/base/atomicops_internals_arm_gcc.h#newcode159 base/atomicops_internals_arm_gcc.h:159: // Available since Linux 2.6.24. Note that the first ...
7 years, 6 months ago (2013-06-04 11:51:56 UTC) #8
digit1
https://chromiumcodereview.appspot.com/16335007/diff/13001/base/atomicops_internals_arm_gcc.h File base/atomicops_internals_arm_gcc.h (right): https://chromiumcodereview.appspot.com/16335007/diff/13001/base/atomicops_internals_arm_gcc.h#newcode176 base/atomicops_internals_arm_gcc.h:176: return prev_value; Also, please note that it looks like ...
7 years, 6 months ago (2013-06-04 12:00:37 UTC) #9
Dmitry Vyukov
https://chromiumcodereview.appspot.com/16335007/diff/13001/base/atomicops_internals_arm_gcc.h File base/atomicops_internals_arm_gcc.h (right): https://chromiumcodereview.appspot.com/16335007/diff/13001/base/atomicops_internals_arm_gcc.h#newcode176 base/atomicops_internals_arm_gcc.h:176: return prev_value; On 2013/06/04 11:51:56, digit1 wrote: > I ...
7 years, 6 months ago (2013-06-04 12:49:32 UTC) #10
digit1
https://chromiumcodereview.appspot.com/16335007/diff/13001/base/atomicops_internals_arm_gcc.h File base/atomicops_internals_arm_gcc.h (right): https://chromiumcodereview.appspot.com/16335007/diff/13001/base/atomicops_internals_arm_gcc.h#newcode142 base/atomicops_internals_arm_gcc.h:142: : "memory"); Thanks for the details, I've put "cc" ...
7 years, 6 months ago (2013-06-04 13:24:17 UTC) #11
Dmitry Vyukov
I am not an expert in ARM, but LGTM FWIW
7 years, 6 months ago (2013-06-04 13:32:39 UTC) #12
JF
lgtm
7 years, 6 months ago (2013-06-04 16:21:40 UTC) #13
digit1
Thank you, I've added a few owners and bbudge@ as reviewers.
7 years, 6 months ago (2013-06-05 09:59:21 UTC) #14
digit1
And I've filed two issues to address the MIPS and gcc intrinsics issues discovered here. ...
7 years, 6 months ago (2013-06-05 10:21:36 UTC) #15
bbudge
NaCl part lgtm. Thanks for fixing this.
7 years, 6 months ago (2013-06-05 12:40:08 UTC) #16
Mark Mentovai
https://chromiumcodereview.appspot.com/16335007/diff/11003/base/atomicops_internals_arm_gcc.h File base/atomicops_internals_arm_gcc.h (right): https://chromiumcodereview.appspot.com/16335007/diff/11003/base/atomicops_internals_arm_gcc.h#newcode15 base/atomicops_internals_arm_gcc.h:15: // Memory barriers on ARM are funky, but the ...
7 years, 6 months ago (2013-06-05 13:34:31 UTC) #17
digit1
https://chromiumcodereview.appspot.com/16335007/diff/11003/base/atomicops_internals_arm_gcc.h File base/atomicops_internals_arm_gcc.h (right): https://chromiumcodereview.appspot.com/16335007/diff/11003/base/atomicops_internals_arm_gcc.h#newcode18 base/atomicops_internals_arm_gcc.h:18: // all on this architecture, or when targetting its ...
7 years, 6 months ago (2013-06-05 16:35:46 UTC) #18
Mark Mentovai
LGTM I’m surprised by "cc", "memory" appearing everywhere they do, but it looks like you’ve ...
7 years, 6 months ago (2013-06-05 16:46:40 UTC) #19
digit1
On 2013/06/05 16:46:40, Mark Mentovai wrote: > https://chromiumcodereview.appspot.com/16335007/diff/31001/base/atomicops_internals_arm_gcc.h#newcode39 > base/atomicops_internals_arm_gcc.h:39: // when targetting ARMv5TE. > ...
7 years, 6 months ago (2013-06-06 11:01:42 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/digit@chromium.org/16335007/35001
7 years, 6 months ago (2013-06-06 11:02:11 UTC) #21
commit-bot: I haz the power
Retried try job too often on mac_rel for step(s) content_browsertests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=mac_rel&number=135391
7 years, 6 months ago (2013-06-06 12:59:36 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/digit@chromium.org/16335007/35001
7 years, 6 months ago (2013-06-06 13:27:34 UTC) #23
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
7 years, 6 months ago (2013-06-06 13:38:26 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/digit@chromium.org/16335007/52001
7 years, 6 months ago (2013-06-10 12:13:00 UTC) #25
commit-bot: I haz the power
7 years, 6 months ago (2013-06-10 14:00:07 UTC) #26
Message was sent while issue was closed.
Change committed as 205205

Powered by Google App Engine
This is Rietveld 408576698