Thu, 01 Sep 2016 06:16:05 -0700
8152438: Threads may do significant work out of the non-shared overflow buffer
Summary: Before processing an element in the non-shared overflow buffer, try to push it into the local shared buffer to keep it full.
Reviewed-by: jmasa, ehelin, sjohanss
src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp | file | annotate | diff | comparison | revisions | |
src/share/vm/utilities/taskqueue.hpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp Thu Sep 15 09:06:56 2016 -0700 1.2 +++ b/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp Thu Sep 01 06:16:05 2016 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -148,7 +148,9 @@ 1.11 do { 1.12 // Drain the overflow stack first, so other threads can steal. 1.13 while (_refs->pop_overflow(ref)) { 1.14 - dispatch_reference(ref); 1.15 + if (!_refs->try_push_to_taskqueue(ref)) { 1.16 + dispatch_reference(ref); 1.17 + } 1.18 } 1.19 1.20 while (_refs->pop_local(ref)) {
2.1 --- a/src/share/vm/utilities/taskqueue.hpp Thu Sep 15 09:06:56 2016 -0700 2.2 +++ b/src/share/vm/utilities/taskqueue.hpp Thu Sep 01 06:16:05 2016 -0700 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -453,6 +453,9 @@ 2.11 // Push task t onto the queue or onto the overflow stack. Return true. 2.12 inline bool push(E t); 2.13 2.14 + // Try to push task t onto the queue only. Returns true if successful, false otherwise. 2.15 + inline bool try_push_to_taskqueue(E t); 2.16 + 2.17 // Attempt to pop from the overflow stack; return true if anything was popped. 2.18 inline bool pop_overflow(E& t); 2.19 2.20 @@ -486,6 +489,10 @@ 2.21 return true; 2.22 } 2.23 2.24 +template <class E, MEMFLAGS F, unsigned int N> 2.25 +bool OverflowTaskQueue<E, F, N>::try_push_to_taskqueue(E t) { 2.26 + return taskqueue_t::push(t); 2.27 +} 2.28 class TaskQueueSetSuper { 2.29 protected: 2.30 static int randomParkAndMiller(int* seed0);