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

Issue 2627153004: Use TLS storage for thread ids in wtf/ThreadingPThreads (Closed)

Created:
3 years, 11 months ago by Charlie Harrison
Modified:
3 years, 11 months ago
Reviewers:
haraken, esprehn
CC:
blink-reviews, blink-reviews-wtf_chromium.org, chromium-reviews, Mikhail, slangley
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use TLS storage for thread ids in wtf/ThreadingPThreads This reduces currentThread() overhead by > ~95-99% on Linux (on my Z620). BUG=442246 Review-Url: https://codereview.chromium.org/2627153004 Cr-Commit-Position: refs/heads/master@{#443701} Committed: https://chromium.googlesource.com/chromium/src/+/6deb801a3e4cd94c3a472b4e67520653afbbd380

Patch Set 1 #

Patch Set 2 : subtle #

Patch Set 3 : esprehn suggestion #

Total comments: 2

Patch Set 4 : internal:: #

Patch Set 5 : const #

Total comments: 2

Patch Set 6 : add internal::currentThreadSyscall for windows #

Total comments: 4

Patch Set 7 : just move isMainThread() down to avoid lazy alloc #

Total comments: 2

Patch Set 8 : remove unnecessary include (trybots prev) #

Unified diffs Side-by-side diffs Delta from patch set Stats (+49 lines, -14 lines) Patch
M third_party/WebKit/Source/wtf/ThreadSpecific.h View 1 2 3 4 5 6 7 2 chunks +7 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/wtf/Threading.h View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/wtf/ThreadingPthreads.cpp View 1 2 3 2 chunks +23 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/wtf/ThreadingWin.cpp View 1 2 3 4 5 2 chunks +9 lines, -1 line 0 comments Download
M third_party/WebKit/Source/wtf/WTFThreadData.h View 1 2 3 4 1 chunk +4 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/wtf/WTFThreadData.cpp View 1 2 1 chunk +2 lines, -1 line 0 comments Download

Dependent Patchsets:

Messages

Total messages: 59 (35 generated)
Charlie Harrison
Haraken, I think this is unrelated to crbug.com/621786 which (I think) is about doing the ...
3 years, 11 months ago (2017-01-12 18:25:10 UTC) #10
esprehn
Can we put this in wtfThreadData() instead? wtfThreadData().threadId() instead?
3 years, 11 months ago (2017-01-12 18:41:29 UTC) #13
Charlie Harrison
Great idea, done! I didn't even realize that class existed :P How does it avoid ...
3 years, 11 months ago (2017-01-12 19:03:38 UTC) #16
Charlie Harrison
re-adding esprehn to reviewer who somehow lost the cc. (I've done as you suggested in ...
3 years, 11 months ago (2017-01-12 19:20:34 UTC) #18
esprehn
lgtm, failed to compile though, did you forget to include something? FAILED: obj/third_party/WebKit/Source/wtf/wtf/ThreadingPthreads.o export DEVELOPER_DIR=/b/c/b/mac/src/build/mac_files/Xcode.app; ...
3 years, 11 months ago (2017-01-12 19:38:50 UTC) #21
Charlie Harrison
Yeah, I had a compile error for non TLS platforms (forgot an internal::). Should be ...
3 years, 11 months ago (2017-01-12 19:44:33 UTC) #24
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/2627153004/80001
3 years, 11 months ago (2017-01-12 19:45:56 UTC) #27
Charlie Harrison
BTW thanks for the prompt review!
3 years, 11 months ago (2017-01-12 19:55:45 UTC) #28
esprehn
https://codereview.chromium.org/2627153004/diff/80001/third_party/WebKit/Source/wtf/WTFThreadData.cpp File third_party/WebKit/Source/wtf/WTFThreadData.cpp (right): https://codereview.chromium.org/2627153004/diff/80001/third_party/WebKit/Source/wtf/WTFThreadData.cpp#newcode39 third_party/WebKit/Source/wtf/WTFThreadData.cpp:39: m_threadId(internal::currentThreadSyscall()) {} How does this work on non-pthreads platforms? ...
3 years, 11 months ago (2017-01-12 19:59:11 UTC) #29
Charlie Harrison
https://codereview.chromium.org/2627153004/diff/80001/third_party/WebKit/Source/wtf/WTFThreadData.cpp File third_party/WebKit/Source/wtf/WTFThreadData.cpp (right): https://codereview.chromium.org/2627153004/diff/80001/third_party/WebKit/Source/wtf/WTFThreadData.cpp#newcode39 third_party/WebKit/Source/wtf/WTFThreadData.cpp:39: m_threadId(internal::currentThreadSyscall()) {} On 2017/01/12 19:59:11, esprehn wrote: > How ...
3 years, 11 months ago (2017-01-12 20:07:46 UTC) #31
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/2627153004/100001
3 years, 11 months ago (2017-01-12 20:59:47 UTC) #37
Charlie Harrison
Interestingly, it looks like LSAN is reporting leaks with this CL. I'm not familiar with ...
3 years, 11 months ago (2017-01-12 22:46:55 UTC) #39
esprehn
On 2017/01/12 at 22:46:55, csharrison wrote: > Interestingly, it looks like LSAN is reporting leaks ...
3 years, 11 months ago (2017-01-12 23:10:27 UTC) #40
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_asan_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_asan_rel_ng/builds/292079)
3 years, 11 months ago (2017-01-12 23:25:54 UTC) #42
Charlie Harrison
You're right, I think this is (at least) a real leak where we call isMainThread() ...
3 years, 11 months ago (2017-01-12 23:31:25 UTC) #43
haraken
LGTM https://codereview.chromium.org/2627153004/diff/100001/third_party/WebKit/Source/wtf/ThreadingPthreads.cpp File third_party/WebKit/Source/wtf/ThreadingPthreads.cpp (right): https://codereview.chromium.org/2627153004/diff/100001/third_party/WebKit/Source/wtf/ThreadingPthreads.cpp#newcode109 third_party/WebKit/Source/wtf/ThreadingPthreads.cpp:109: #else On what platform do we hit this ...
3 years, 11 months ago (2017-01-13 04:33:44 UTC) #44
haraken
https://codereview.chromium.org/2627153004/diff/100001/third_party/WebKit/Source/wtf/ThreadingPthreads.cpp File third_party/WebKit/Source/wtf/ThreadingPthreads.cpp (right): https://codereview.chromium.org/2627153004/diff/100001/third_party/WebKit/Source/wtf/ThreadingPthreads.cpp#newcode106 third_party/WebKit/Source/wtf/ThreadingPthreads.cpp:106: // TLS lookup is fast on these platforms. Have ...
3 years, 11 months ago (2017-01-13 04:36:07 UTC) #45
Charlie Harrison
Ok, so I think the current PS is good enough to stop leaks. LSAN is ...
3 years, 11 months ago (2017-01-13 16:38:45 UTC) #48
Charlie Harrison
BTW esprehn I will wait for l-g from you before landing to double check my ...
3 years, 11 months ago (2017-01-13 16:56:55 UTC) #49
esprehn
PTHREAD_DESTRUCTOR_ITERATIONS seems to be a small number like 4, I worry we could end up ...
3 years, 11 months ago (2017-01-13 17:48:46 UTC) #50
Charlie Harrison
On 2017/01/13 17:48:46, esprehn wrote: > PTHREAD_DESTRUCTOR_ITERATIONS seems to be a small number like 4, ...
3 years, 11 months ago (2017-01-13 17:56:37 UTC) #51
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/2627153004/140001
3 years, 11 months ago (2017-01-13 17:57:33 UTC) #54
Charlie Harrison
FYI I am not observing a major speed up on Android with this change. I ...
3 years, 11 months ago (2017-01-13 20:45:46 UTC) #55
commit-bot: I haz the power
3 years, 11 months ago (2017-01-13 22:30:06 UTC) #59
Message was sent while issue was closed.
Committed patchset #8 (id:140001) as
https://chromium.googlesource.com/chromium/src/+/6deb801a3e4cd94c3a472b4e6752...

Powered by Google App Engine
This is Rietveld 408576698