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

Issue 367633002: [oilpan]: Don't enter safepoint in SafePointAwareMutexLocker if sweeping. (Closed)

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

Description

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+5 lines, -1 line) Patch
M Source/platform/heap/ThreadState.h View 1 chunk +5 lines, -1 line 1 comment Download

Messages

Total messages: 10 (0 generated)
wibling-chromium
Change r177124 uncovered another bug where we try entering a safepoint while sweeping. This should ...
6 years, 5 months ago (2014-07-01 09:24:26 UTC) #1
tkent
lgtm. Thanks!
6 years, 5 months ago (2014-07-01 09:34:32 UTC) #2
tkent
The CQ bit was checked by tkent@chromium.org
6 years, 5 months ago (2014-07-01 09:34:39 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/wibling@chromium.org/367633002/1
6 years, 5 months ago (2014-07-01 09:35:02 UTC) #4
Erik Corry
lgtm
6 years, 5 months ago (2014-07-01 09:36:55 UTC) #5
zerny-chromium
lgtm
6 years, 5 months ago (2014-07-01 09:40:23 UTC) #6
haraken
https://codereview.chromium.org/367633002/diff/1/Source/platform/heap/ThreadState.h File Source/platform/heap/ThreadState.h (right): https://codereview.chromium.org/367633002/diff/1/Source/platform/heap/ThreadState.h#newcode623 Source/platform/heap/ThreadState.h:623: // due to this thread not being at a ...
6 years, 5 months ago (2014-07-01 10:35:10 UTC) #7
commit-bot: I haz the power
Change committed as 177290
6 years, 5 months ago (2014-07-01 10:42:01 UTC) #8
wibling-chromium
On 2014/07/01 10:35:10, haraken wrote: > https://codereview.chromium.org/367633002/diff/1/Source/platform/heap/ThreadState.h > File Source/platform/heap/ThreadState.h (right): > > https://codereview.chromium.org/367633002/diff/1/Source/platform/heap/ThreadState.h#newcode623 > ...
6 years, 5 months ago (2014-07-01 11:10:59 UTC) #9
haraken
6 years, 5 months ago (2014-07-01 11:39:36 UTC) #10
Message was sent while issue was closed.
On 2014/07/01 11:10:59, wibling-chromium wrote:
> On 2014/07/01 10:35:10, haraken wrote:
> >
>
https://codereview.chromium.org/367633002/diff/1/Source/platform/heap/ThreadS...
> > File Source/platform/heap/ThreadState.h (right):
> > 
> >
>
https://codereview.chromium.org/367633002/diff/1/Source/platform/heap/ThreadS...
> > Source/platform/heap/ThreadState.h:623: // due to this thread not being at a
> > safepoint and waiting on the lock.
> > 
> > Would you elaborate on why this doesn't cause dead lock?
> > 
> > (1) Thread 1 is sweeping.
> > (2) Thread 2 calls SafePointAwareMutexLocker. It acquires the mutex.
> > (3) Thread 2 triggers a GC.
> > (4) Thread 1 calls SafePointAwareMutexLocker. It tries to acquire the mutex.
> > (5) Dead lock?
> 
> Thread 2 will time out in step 3 since Thread 1 will never enter a safepoint
as
> it was sweeping.
> This will not dead-lock but only lead to a GC which does not do anything. It
is
> unfortunate, but 
> at least it will continue after the timeout.
> 
> > Actually I don't fully understand why we cannot enter a safe point while
> > sweeping. It seems we can just enter a safe point, and if a GC is triggered
we
> > can just clear the mark bits and restart the GC. I'd be happy if you could
> just
> > help me understand :)
> 
> There is a couple of reasons. We do both thread local weak processing as well
as
> sweeping in the "sweep" phase (ThreadState::performPendingSweep).
> If we are doing weak processing and popping a weak callback we are using the
> thread specific weak callback stack which is also used when tracing. We don't
> currently support pushing weak callbacks from a GC thread while another thread
> is in the middle of popping them.
> If we are doing actual sweeping of a page and enters a safepoint in a
destructor
> we will get back and continue sweeping. However we will now have thrown away
any
> free list entries we have built up in the sweep so far. We will also not sweep
> the pages that were already swept by this thread and clear the object mark
bits
> on these pages.
> We might be able to trigger another sweep by abandoning the first sweep, but
it
> is a rather elaborate change and the above case should be very infrequent.

Thanks for the clarification, makes sense! I understand that a GC must not be
triggered during thread-specific weak processing (this is guaranteed by not
allowing allocation during thread-specific weak processing) and during sweeping
(this is guaranteed by not allowing to start a GC in Heap::allocate called in
destructors).

LGTM.

Powered by Google App Engine
This is Rietveld 408576698