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

Issue 1158243004: Fix nested parking of threads while setting up a garbage collection. (Closed)

Created:
5 years, 7 months ago by sof
Modified:
5 years, 6 months ago
Reviewers:
haraken
CC:
blink-reviews, oilpan-reviews, kouhei+heap_chromium.org, Mads Ager (chromium)
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Fix nested parking of threads while setting up a garbage collection. When a thread requests a GC, it first enters a safe point to indicate that it is prepared to garbage collect. After that it tries to interrupt/ notify the other threads to also enter safe points and waits around for them to enter that state. While waiting, it will block other threads from attempting to similarly park threads. But, should another thread trigger a GC while the parking thread is waiting, it will first enter a safe point, but then proceed to try to park the other threads. Which it will be blocked from making progress on due to the above lock being taken by the initial thread requesting thread parking. By initially entering a safe point though, the first thread may indirectly reach the desired condition of all threads being parked. Which means it can safely proceed with the GC _along_ with releasing the lock for other threads to attempt to park thread. The second parking thread will then do so, but be blocked waiting for all the threads to park. The thread that has proceeded to initiate a GC will not do so, so after the max parking time has passed, the second thread will signal that it failed to park the other threads, and try to abort its attempted GC. As part of that abort/cancellation step, it will attempt to reset its GCState back to what it was when the GC attempt was initiated. That GCState may have changed behind the thread's back -- the initial thread has proceeded with a GC, and will as part of that change the GCState of each attached thread. Hence, GC cancellation needs to check that the GCState it is trying to reset from is the expected one. If it isn't, that is a sign that another thread has initiated a GC and it should just quietly return. Which means waiting for it to be allowed to leave its safe point..and at that point perform the thread-specific parts of the GC. R=haraken BUG=487952 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=196037

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2 lines, -1 line) Patch
M Source/platform/heap/Heap.cpp View 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 7 (2 generated)
haraken
Thanks for the great detective work!! This looks good, but another possible fix would be ...
5 years, 6 months ago (2015-05-28 01:31:48 UTC) #2
sof
On 2015/05/28 01:31:48, haraken wrote: > Thanks for the great detective work!! > > This ...
5 years, 6 months ago (2015-05-28 05:20:52 UTC) #3
haraken
On 2015/05/28 05:20:52, sof wrote: > On 2015/05/28 01:31:48, haraken wrote: > > Thanks for ...
5 years, 6 months ago (2015-05-28 05:44:19 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1158243004/1
5 years, 6 months ago (2015-05-28 06:32:00 UTC) #6
commit-bot: I haz the power
5 years, 6 months ago (2015-05-28 06:35:16 UTC) #7
Message was sent while issue was closed.
Committed patchset #1 (id:1) as
https://src.chromium.org/viewvc/blink?view=rev&revision=196037

Powered by Google App Engine
This is Rietveld 408576698