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

Issue 2890363003: Enable sharding of AllocationRegister on desktop. (Closed)

Created:
3 years, 7 months ago by erikchen
Modified:
3 years, 7 months ago
CC:
chromium-reviews, tracing+reviews_chromium.org, wfh+watch_chromium.org, danakj+watch_chromium.org, vmpstr+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Enable sharding of AllocationRegister on desktop. Previously, when native heap profiling was enabled, all allocations in a process were gated by a global lock. This proves to be a significant performance hit on macOS. Profiling shows that 50-75% of all wall time is spent waiting on this lock. This CL introduces a new class ShardedAllocationRegister to handle sharding for desktop platforms. This stores allocation/backtrace information across 64 different AllocationRegister instances. In addition, the sizes of the fixed size hash maps were changed. The number of allocation buckets was reduced by a factor of 8, and the number of backtrace buckets reduced by a factor of 16. The new class ShardedAllocationRegister is thread-safe, and its consumers no longer need to acquire a lock when using the container. Each consumer still needs to know whether heap profiling is enabled. This CL uses a subtle::Atomic32 along with Acquire_Load and Release_Store to determine this state. Using a bool to record this state and a base::Lock to synchronize reading/writing from the bool has performance almost as bad as the global lock. BUG=724651 Review-Url: https://codereview.chromium.org/2890363003 Cr-Commit-Position: refs/heads/master@{#473696} Committed: https://chromium.googlesource.com/chromium/src/+/bd599af5d33647f0b498311eab05be79fac98e63

Patch Set 1 #

Patch Set 2 : Fix performance. #

Patch Set 3 : Fixes. #

Patch Set 4 : clang format. #

Patch Set 5 : comment from primiano. #

Total comments: 20

Patch Set 6 : Comments from primiano. #

Patch Set 7 : Clean up. #

Total comments: 4

Patch Set 8 : comments from primiano, thakis. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+281 lines, -160 lines) Patch
M base/BUILD.gn View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M base/trace_event/heap_profiler_allocation_register.h View 1 2 3 4 5 5 chunks +20 lines, -14 lines 0 comments Download
M base/trace_event/heap_profiler_allocation_register.cc View 1 2 3 4 5 3 chunks +22 lines, -25 lines 0 comments Download
M base/trace_event/malloc_dump_provider.h View 1 2 3 4 5 6 3 chunks +2 lines, -6 lines 0 comments Download
M base/trace_event/malloc_dump_provider.cc View 1 2 3 4 5 7 chunks +24 lines, -43 lines 0 comments Download
A base/trace_event/sharded_allocation_register.h View 1 2 3 4 5 6 7 1 chunk +88 lines, -0 lines 0 comments Download
A base/trace_event/sharded_allocation_register.cc View 1 2 3 4 5 6 7 1 chunk +92 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/PartitionAllocMemoryDumpProvider.h View 1 2 3 4 5 6 2 chunks +2 lines, -12 lines 0 comments Download
M third_party/WebKit/Source/platform/PartitionAllocMemoryDumpProvider.cpp View 1 2 3 4 5 4 chunks +14 lines, -28 lines 0 comments Download
M third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.h View 1 2 3 4 5 6 2 chunks +2 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp View 1 2 3 4 5 5 chunks +13 lines, -27 lines 0 comments Download

Messages

Total messages: 66 (38 generated)
erikchen
primiano: Please review.
3 years, 7 months ago (2017-05-20 01:42:17 UTC) #15
Primiano Tucci (use gerrit)
On 2017/05/20 01:42:17, erikchen wrote: > primiano: Please review. Sorry for the incomplete review but, ...
3 years, 7 months ago (2017-05-20 02:52:44 UTC) #17
erikchen
On 2017/05/20 02:52:44, Primiano (slow - traveling) wrote: > On 2017/05/20 01:42:17, erikchen wrote: > ...
3 years, 7 months ago (2017-05-20 17:26:42 UTC) #22
Primiano Tucci (use gerrit)
On 2017/05/20 17:26:42, erikchen wrote: > Sorry, calling premature optimization on this one. The performance ...
3 years, 7 months ago (2017-05-22 15:45:09 UTC) #25
DmitrySkiba
Couple of thoughts: First, it seems that three parameters (2 hash table capacities and a ...
3 years, 7 months ago (2017-05-22 15:55:22 UTC) #27
erikchen
On 2017/05/22 15:55:22, DmitrySkiba wrote: > Couple of thoughts: > > First, it seems that ...
3 years, 7 months ago (2017-05-22 16:24:52 UTC) #28
Primiano Tucci (use gerrit)
https://codereview.chromium.org/2890363003/diff/80001/base/trace_event/malloc_dump_provider.cc File base/trace_event/malloc_dump_provider.cc (right): https://codereview.chromium.org/2890363003/diff/80001/base/trace_event/malloc_dump_provider.cc#newcode307 base/trace_event/malloc_dump_provider.cc:307: { at this point this {} scope delimiter is ...
3 years, 7 months ago (2017-05-22 16:37:51 UTC) #29
erikchen
primiano: PTAL https://codereview.chromium.org/2890363003/diff/80001/base/trace_event/malloc_dump_provider.cc File base/trace_event/malloc_dump_provider.cc (right): https://codereview.chromium.org/2890363003/diff/80001/base/trace_event/malloc_dump_provider.cc#newcode307 base/trace_event/malloc_dump_provider.cc:307: { On 2017/05/22 16:37:50, Primiano Tucci wrote: ...
3 years, 7 months ago (2017-05-22 17:10:43 UTC) #33
DmitrySkiba
On 2017/05/22 16:24:52, erikchen wrote: > On 2017/05/22 15:55:22, DmitrySkiba wrote: > > Couple of ...
3 years, 7 months ago (2017-05-22 17:36:05 UTC) #35
Primiano Tucci (use gerrit)
Cool, thanks a lot for the patience. Now that we are done with nits and ...
3 years, 7 months ago (2017-05-22 17:37:55 UTC) #36
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2890363003/120001
3 years, 7 months ago (2017-05-22 17:42:28 UTC) #39
DmitrySkiba
On 2017/05/22 17:37:55, Primiano Tucci wrote: > Cool, thanks a lot for the patience. > ...
3 years, 7 months ago (2017-05-22 17:44:47 UTC) #42
Primiano Tucci (use gerrit)
On 2017/05/22 17:36:05, DmitrySkiba wrote: > I see. BTW, why do we need ShardedAllocationRegister thing ...
3 years, 7 months ago (2017-05-22 17:44:59 UTC) #44
erikchen
thakis: Please review third_party/WebKit/Source/platform/*
3 years, 7 months ago (2017-05-22 17:46:29 UTC) #46
DmitrySkiba
On 2017/05/22 17:44:59, Primiano Tucci wrote: > On 2017/05/22 17:36:05, DmitrySkiba wrote: > > I ...
3 years, 7 months ago (2017-05-22 17:49:17 UTC) #47
Primiano Tucci (use gerrit)
On 2017/05/22 17:44:47, DmitrySkiba wrote: > On 2017/05/22 17:37:55, Primiano Tucci wrote: > > Cool, ...
3 years, 7 months ago (2017-05-22 17:49:39 UTC) #48
Primiano Tucci (use gerrit)
On 2017/05/22 17:49:17, DmitrySkiba wrote: > On 2017/05/22 17:44:59, Primiano Tucci wrote: > > On ...
3 years, 7 months ago (2017-05-22 17:56:45 UTC) #49
DmitrySkiba
On 2017/05/22 17:49:39, Primiano Tucci wrote: > On 2017/05/22 17:44:47, DmitrySkiba wrote: > > On ...
3 years, 7 months ago (2017-05-22 17:56:50 UTC) #50
Primiano Tucci (use gerrit)
On 2017/05/22 17:56:50, DmitrySkiba wrote: > Yes, so the burden to write tests falls to ...
3 years, 7 months ago (2017-05-22 18:48:10 UTC) #51
Nico
https://codereview.chromium.org/2890363003/diff/120001/third_party/WebKit/Source/platform/PartitionAllocMemoryDumpProvider.cpp File third_party/WebKit/Source/platform/PartitionAllocMemoryDumpProvider.cpp (right): https://codereview.chromium.org/2890363003/diff/120001/third_party/WebKit/Source/platform/PartitionAllocMemoryDumpProvider.cpp#newcode201 third_party/WebKit/Source/platform/PartitionAllocMemoryDumpProvider.cpp:201: if (!allocation_register_.is_enabled()) I assume it's not a problem that ...
3 years, 7 months ago (2017-05-22 18:48:34 UTC) #52
Nico
Durr, forgot to say "webkit/platform lgtm"
3 years, 7 months ago (2017-05-22 18:48:51 UTC) #53
Primiano Tucci (use gerrit)
https://codereview.chromium.org/2890363003/diff/120001/third_party/WebKit/Source/platform/PartitionAllocMemoryDumpProvider.cpp File third_party/WebKit/Source/platform/PartitionAllocMemoryDumpProvider.cpp (right): https://codereview.chromium.org/2890363003/diff/120001/third_party/WebKit/Source/platform/PartitionAllocMemoryDumpProvider.cpp#newcode201 third_party/WebKit/Source/platform/PartitionAllocMemoryDumpProvider.cpp:201: if (!allocation_register_.is_enabled()) On 2017/05/22 18:48:34, Nico wrote: > I ...
3 years, 7 months ago (2017-05-22 18:51:30 UTC) #54
Nico
On Mon, May 22, 2017 at 2:51 PM, <primiano@chromium.org> wrote: > > https://codereview.chromium.org/2890363003/diff/120001/ > third_party/WebKit/Source/platform/PartitionAllocMemoryDumpProvider.cpp ...
3 years, 7 months ago (2017-05-22 18:52:41 UTC) #55
erikchen
https://codereview.chromium.org/2890363003/diff/120001/base/trace_event/sharded_allocation_register.cc File base/trace_event/sharded_allocation_register.cc (right): https://codereview.chromium.org/2890363003/diff/120001/base/trace_event/sharded_allocation_register.cc#newcode16 base/trace_event/sharded_allocation_register.cc:16: size_t ShardCount = 1; On 2017/05/22 17:37:55, Primiano Tucci ...
3 years, 7 months ago (2017-05-22 19:15:33 UTC) #58
erikchen
> > > Sounds like this might be subtle enough to warrant a comment? Done
3 years, 7 months ago (2017-05-22 19:15:48 UTC) #59
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2890363003/140001
3 years, 7 months ago (2017-05-22 19:16:21 UTC) #62
erikchen
On 2017/05/22 19:16:21, commit-bot: I haz the power wrote: > CQ is trying da patch. ...
3 years, 7 months ago (2017-05-22 19:48:52 UTC) #63
commit-bot: I haz the power
3 years, 7 months ago (2017-05-22 21:15:25 UTC) #66
Message was sent while issue was closed.
Committed patchset #8 (id:140001) as
https://chromium.googlesource.com/chromium/src/+/bd599af5d33647f0b498311eab05...

Powered by Google App Engine
This is Rietveld 408576698