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

Issue 643883002: Oilpan: Avoid looking up TLS in ThreadState::current() (Closed)

Created:
6 years, 2 months ago by haraken
Modified:
6 years, 2 months ago
CC:
blink-reviews, kouhei+heap_chromium.org, Mads Ager (chromium), mkwst+moarreviews_chromium.org
Project:
blink
Visibility:
Public.

Description

Oilpan: Avoid looking up TLS in ThreadState::current() This CL adds a fast, conservative way to determine if we are in the main thread. 1) In ThreadState::init(), take the underestimated size of the main thread. 2) When ThreadState::current() is called, check if the current stack address is within the underestimated size from the stack start of the main thread. If yes, we can immediately return the mainThreadState() without looking up TLS. Otherwise, we look up TLS. TLS is very slow especially in Mac and Windows. This CL improves blink_perf.parser.querySelector-* (and other) benchmarks by 6% in Mac. BUG=420515 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=183637

Patch Set 1 #

Patch Set 2 : #

Total comments: 1

Patch Set 3 : #

Total comments: 7

Patch Set 4 : #

Patch Set 5 : #

Total comments: 4

Patch Set 6 : #

Patch Set 7 : #

Patch Set 8 : #

Patch Set 9 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+56 lines, -1 line) Patch
M Source/platform/heap/ThreadState.h View 1 2 3 4 5 2 chunks +23 lines, -1 line 0 comments Download
M Source/platform/heap/ThreadState.cpp View 1 2 3 4 5 6 7 3 chunks +33 lines, -0 lines 0 comments Download

Messages

Total messages: 28 (7 generated)
haraken
PTAL
6 years, 2 months ago (2014-10-10 10:13:33 UTC) #2
haraken
This optimization idea was rejected in https://codereview.chromium.org/113693002/ (9 months ago), but it would make sense ...
6 years, 2 months ago (2014-10-10 10:18:02 UTC) #3
Mads Ager (chromium)
https://codereview.chromium.org/643883002/diff/40001/Source/platform/heap/ThreadState.h File Source/platform/heap/ThreadState.h (right): https://codereview.chromium.org/643883002/diff/40001/Source/platform/heap/ThreadState.h#newcode385 Source/platform/heap/ThreadState.h:385: if (LIKELY(addressDiff <= 1024 * 1024)) { There is ...
6 years, 2 months ago (2014-10-10 13:44:36 UTC) #5
haraken
On 2014/10/10 13:44:36, Mads Ager (chromium) wrote: > https://codereview.chromium.org/643883002/diff/40001/Source/platform/heap/ThreadState.h > File Source/platform/heap/ThreadState.h (right): > > ...
6 years, 2 months ago (2014-10-10 13:57:02 UTC) #6
Vyacheslav Egorov (Google)
FWIW apparently NaCl does quite an hack to get fast TLS access: they check in ...
6 years, 2 months ago (2014-10-10 14:12:26 UTC) #8
sof
On 2014/10/10 14:12:26, Vyacheslav Egorov (Google) wrote: > FWIW apparently NaCl does quite an hack ...
6 years, 2 months ago (2014-10-10 18:04:01 UTC) #9
Vyacheslav Egorov (Google)
We should not really call getStackStart() on the performance critical path anywhere, so I don't ...
6 years, 2 months ago (2014-10-10 19:13:15 UTC) #10
haraken
On 2014/10/10 19:13:15, Vyacheslav Egorov (Google) wrote: > We should not really call getStackStart() on ...
6 years, 2 months ago (2014-10-11 01:03:31 UTC) #11
haraken
Implemented getStackSize(), although I'm not sure if the implementation is correct. The problem is that ...
6 years, 2 months ago (2014-10-12 07:19:31 UTC) #12
sof
https://codereview.chromium.org/643883002/diff/170001/Source/platform/heap/ThreadState.h File Source/platform/heap/ThreadState.h (right): https://codereview.chromium.org/643883002/diff/170001/Source/platform/heap/ThreadState.h#newcode385 Source/platform/heap/ThreadState.h:385: unsigned addressDiff = s_mainThreadStackStart - reinterpret_cast<intptr_t>(&dummy); To remain safe, ...
6 years, 2 months ago (2014-10-12 07:53:55 UTC) #14
sof
https://codereview.chromium.org/643883002/diff/170001/Source/platform/heap/ThreadState.cpp File Source/platform/heap/ThreadState.cpp (right): https://codereview.chromium.org/643883002/diff/170001/Source/platform/heap/ThreadState.cpp#newcode128 Source/platform/heap/ThreadState.cpp:128: return __readgsqword(offsetof(NT_TIB64, StackBase)) - __readgsqword(offsetof(NT_TIB64, StackLimit)); Does this account ...
6 years, 2 months ago (2014-10-12 08:09:24 UTC) #15
haraken
https://codereview.chromium.org/643883002/diff/170001/Source/platform/heap/ThreadState.cpp File Source/platform/heap/ThreadState.cpp (right): https://codereview.chromium.org/643883002/diff/170001/Source/platform/heap/ThreadState.cpp#newcode128 Source/platform/heap/ThreadState.cpp:128: return __readgsqword(offsetof(NT_TIB64, StackBase)) - __readgsqword(offsetof(NT_TIB64, StackLimit)); On 2014/10/12 08:09:23, ...
6 years, 2 months ago (2014-10-12 08:45:50 UTC) #16
sof
The optimization made looks sound&fine to me, but deferring to platform/heap/ owners. [ The hottest ...
6 years, 2 months ago (2014-10-12 11:39:17 UTC) #17
haraken
Slava@: Would you take a look? Mads is on vacation. https://codereview.chromium.org/643883002/diff/170001/Source/platform/heap/ThreadState.h File Source/platform/heap/ThreadState.h (right): https://codereview.chromium.org/643883002/diff/170001/Source/platform/heap/ThreadState.h#newcode385 ...
6 years, 2 months ago (2014-10-12 12:46:12 UTC) #18
haraken
6 years, 2 months ago (2014-10-12 12:55:28 UTC) #19
Vyacheslav Egorov (Google)
lgtm https://codereview.chromium.org/643883002/diff/320001/Source/platform/heap/ThreadState.h File Source/platform/heap/ThreadState.h (right): https://codereview.chromium.org/643883002/diff/320001/Source/platform/heap/ThreadState.h#newcode385 Source/platform/heap/ThreadState.h:385: uintptr_t addressDiff = s_mainThreadStackStart - reinterpret_cast<intptr_t>(&dummy); any reason ...
6 years, 2 months ago (2014-10-13 14:07:24 UTC) #20
haraken
https://codereview.chromium.org/643883002/diff/320001/Source/platform/heap/ThreadState.h File Source/platform/heap/ThreadState.h (right): https://codereview.chromium.org/643883002/diff/320001/Source/platform/heap/ThreadState.h#newcode385 Source/platform/heap/ThreadState.h:385: uintptr_t addressDiff = s_mainThreadStackStart - reinterpret_cast<intptr_t>(&dummy); On 2014/10/13 14:07:23, ...
6 years, 2 months ago (2014-10-13 15:41:38 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/643883002/380001
6 years, 2 months ago (2014-10-13 15:43:04 UTC) #23
commit-bot: I haz the power
Try jobs failed on following builders: mac_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/mac_blink_rel/builds/26878)
6 years, 2 months ago (2014-10-13 16:10:03 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/643883002/270002
6 years, 2 months ago (2014-10-14 01:44:08 UTC) #27
commit-bot: I haz the power
6 years, 2 months ago (2014-10-14 03:25:02 UTC) #28
Message was sent while issue was closed.
Committed patchset #9 (id:270002) as 183637

Powered by Google App Engine
This is Rietveld 408576698