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

Issue 1883093005: Reland (2) of Enable allocator shim for Android (crrev.com/1875043003) (Closed)

Created:
4 years, 8 months ago by Primiano Tucci (use gerrit)
Modified:
4 years, 8 months ago
Reviewers:
pasko, Benoit L, Nico
CC:
chromium-reviews, wfh+watch_chromium.org, Dai Mikurube (NOT FULLTIME)
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Reland (2) of Enable allocator shim for Android (crrev.com/1875043003) Reason for reland: The CL was re-reverted by crrev.com/1884223002 because it broke the internal orderfile bot. The reason of the breakage was the following: - cygprofile.cc instruments all function calls with a __cyg_profile_func_enter preamble. - __cyg_profile_func_enter uses __thread. __thread under the hoods invokes calloc(), on every thread, to initialize the TLS. - The shim layer provides its own implementation of calloc(). - At this point, calloc() gets instrumented as well and it re-enters __cyg_profile_func_enter causing an infinite loop. The key of the problem here is that __thread silently causes calls to calloc() in a way that is out of control of cygprofile.cc. The solution proposed by this CL is the following: - Don't use __thread, use explicit POSIX functions for TLS (also there doesn't seem to be any precendent of using __thread in the codebase). - Use a global variable to prevent re-entrancy of the __cyg_profile_func_enter in the global (once per process) TLS slot initializer. - Re-entrancy is gone. Original issue's description: > Enable allocator shim for Android > > This is a follow-up to crrev.com/1719433002, which introduced the > shim for Android, and enables it by default by setting > use_experimental_allocator_shim=true for Android. > > Build/Perf sheriffs heads up > ---------------------------- > If you see any build error or crash related with __wrap_malloc, > __wrap_free, __real_malloc, __real_free, etc this CL is to blame. > > Performance considerations > ------------------------ > Binary size diff (GN, arm, static, official build): 24k > > I did a mixture of local and trybots run to estimate the perf impact > of this change. Didn't get any conclusive data, everything I tried > seems in the same ballpark, below noise levels. More in details: > > cc_perftests.PrepareTiles on a Nexus 4. > Rationale of the choice: in a previous CL (crbug.com/593344), this > benchmark revealed the presence of two mfences in the malloc path. > Results: https://goo.gl/8VC3Jp in the same ballpark. > > page-cycler on Nexus 9 via trybots: > Results: http://goo.gl/J3i50a seems to suggest that this CL improves > both warm and cold times in most cases. I doubt it, more likely it's > noise. > > All the other perf trybots failed. The perf waterfall seems to be in a > bad state in these days. > > BUG=550886, 598075 > TEST=base_unittests --gtest_filter=AllocatorShimTest.* > TBR=thakis@chromium.org > > Committed: https://crrev.com/ebb95496c73dc0d5ce83968ac619921f154305f7 > Cr-Commit-Position: refs/heads/master@{#386386} BUG=550886, 598075, 602744 TBR=thakis@chromium.org TEST=gn gen out/Debug --args='is_debug=true target_os="android" use_order_profiling=true target_cpu="arm" is_clang=false'; ninja -C out/Debug/ cygprofile_unittests; adb push out/Debug/cygprofile_unittests /data/local/tmp/cygprofile_unittests_debug; adb shell /data/local/tmp/cygprofile_unittests_debug Committed: https://crrev.com/f7a321facfdabd763ecdbc9536c890fe91c8c079 Cr-Commit-Position: refs/heads/master@{#387594}

Patch Set 1 : Original CL #

Patch Set 2 : Fixes to cygprofile.cc #

Total comments: 4

Patch Set 3 : pasko@ review #

Total comments: 6

Patch Set 4 : Use PCHECK #

Patch Set 5 : fix comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+53 lines, -18 lines) Patch
M base/allocator/README.md View 1 chunk +1 line, -1 line 0 comments Download
M base/allocator/allocator_shim_internals.h View 1 chunk +5 lines, -1 line 0 comments Download
M build/common.gypi View 1 chunk +1 line, -1 line 0 comments Download
M build/config/allocator.gni View 1 chunk +1 line, -1 line 0 comments Download
M tools/cygprofile/cygprofile.cc View 1 2 3 4 5 chunks +45 lines, -14 lines 0 comments Download

Messages

Total messages: 24 (10 generated)
Primiano Tucci (use gerrit)
PTAL
4 years, 8 months ago (2016-04-15 09:25:26 UTC) #2
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1883093005/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1883093005/20001
4 years, 8 months ago (2016-04-15 09:30:28 UTC) #5
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 8 months ago (2016-04-15 10:26:54 UTC) #7
pasko
thank you, Primiano overall looking good, 2 comments below https://codereview.chromium.org/1883093005/diff/20001/tools/cygprofile/cygprofile.cc File tools/cygprofile/cygprofile.cc (right): https://codereview.chromium.org/1883093005/diff/20001/tools/cygprofile/cygprofile.cc#newcode62 tools/cygprofile/cygprofile.cc:62: ...
4 years, 8 months ago (2016-04-15 11:42:14 UTC) #8
Primiano Tucci (use gerrit)
Done thanks https://codereview.chromium.org/1883093005/diff/20001/tools/cygprofile/cygprofile.cc File tools/cygprofile/cygprofile.cc (right): https://codereview.chromium.org/1883093005/diff/20001/tools/cygprofile/cygprofile.cc#newcode62 tools/cygprofile/cygprofile.cc:62: // This variable is NOT accessed from ...
4 years, 8 months ago (2016-04-15 12:51:07 UTC) #10
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1883093005/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1883093005/60001
4 years, 8 months ago (2016-04-15 12:54:03 UTC) #12
pasko
https://codereview.chromium.org/1883093005/diff/60001/tools/cygprofile/cygprofile.cc File tools/cygprofile/cygprofile.cc (right): https://codereview.chromium.org/1883093005/diff/60001/tools/cygprofile/cygprofile.cc#newcode61 tools/cygprofile/cygprofile.cc:61: // to avoid compiler otpimizations, as this need to ...
4 years, 8 months ago (2016-04-15 13:00:47 UTC) #13
pasko
https://codereview.chromium.org/1883093005/diff/60001/tools/cygprofile/cygprofile.cc File tools/cygprofile/cygprofile.cc (right): https://codereview.chromium.org/1883093005/diff/60001/tools/cygprofile/cygprofile.cc#newcode72 tools/cygprofile/cygprofile.cc:72: CHECK_EQ(0, pthread_key_create(&g_tls_slot, NULL)); On 2016/04/15 13:00:47, pasko wrote: > ...
4 years, 8 months ago (2016-04-15 13:03:59 UTC) #14
Primiano Tucci (use gerrit)
https://codereview.chromium.org/1883093005/diff/60001/tools/cygprofile/cygprofile.cc File tools/cygprofile/cygprofile.cc (right): https://codereview.chromium.org/1883093005/diff/60001/tools/cygprofile/cygprofile.cc#newcode61 tools/cygprofile/cygprofile.cc:61: // to avoid compiler otpimizations, as this need to ...
4 years, 8 months ago (2016-04-15 13:06:09 UTC) #15
pasko
lgtm, thank you
4 years, 8 months ago (2016-04-15 13:09:05 UTC) #16
Primiano Tucci (use gerrit)
TBR thakis. Nothing has changed from the previous reland, I just fixed the cygprofile code.
4 years, 8 months ago (2016-04-15 13:12:59 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1883093005/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1883093005/100001
4 years, 8 months ago (2016-04-15 13:13:21 UTC) #20
commit-bot: I haz the power
Committed patchset #5 (id:100001)
4 years, 8 months ago (2016-04-15 14:14:39 UTC) #22
commit-bot: I haz the power
4 years, 8 months ago (2016-04-15 14:16:13 UTC) #24
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/f7a321facfdabd763ecdbc9536c890fe91c8c079
Cr-Commit-Position: refs/heads/master@{#387594}

Powered by Google App Engine
This is Rietveld 408576698