diff options
author | Richard Uhler <ruhler@google.com> | 2017-05-12 11:21:08 +0100 |
---|---|---|
committer | Richard Uhler <ruhler@google.com> | 2017-05-16 10:24:50 +0100 |
commit | 8df0f36b4fd5db6da67066da62eccc1e0b81e028 (patch) | |
tree | 9446ca90ac8f17bd8eae4cf68493883e5f574898 /compiler/optimizing/graph_visualizer.cc | |
parent | c8a5b6c38a4e934a7953b07cc12046b01c32ae5d (diff) |
RegisterNativeAllocation: Avoid case of double blocking gc.
If multiple threads call RegisterNativeAllocation causing the blocking
watermark to be exceeded while a background GC is in progress, then
two back-to-back blocking GCs would be performed when a single
blocking GC is sufficient. For example:
1. Thread A RegisterNativeAllocation triggers background GC1
2. Thread A RegisterNativeAllocation triggers blocking GC2
3. Thread A's GC2 waits for GC1 to complete.
4. Thread B RegisterNativeAllocation sees GC2 in progress and waits for
it to complete before triggering a second blocking GC3.
5. GC1 completes.
Because thread B's RegisterNativeAllocation was called before GC1
completed and GC2 had not begun for real, thread B can simply wait for
GC2 to start and finish before returning, rather than waiting for GC2 to
start and finish and then doing a second blocking GC.
This change fixes the behavior so that only a single blocking GC is
performed in this case.
Bug: 36851903
Test: 004-NativeAllocations run test.
Change-Id: I1e178b9ee7bb68703bdc9a09b1041a982de8b2ce
Diffstat (limited to 'compiler/optimizing/graph_visualizer.cc')
0 files changed, 0 insertions, 0 deletions