diff -r e943ff4a475a src/hotspot/share/gc/shared/taskqueue.hpp --- a/src/hotspot/share/gc/shared/taskqueue.hpp Tue Aug 06 08:47:32 2019 +0800 +++ b/src/hotspot/share/gc/shared/taskqueue.hpp Tue Aug 06 11:55:25 2019 +0800 @@ -268,7 +268,7 @@ private: // Slow paths for push, pop_local. (pop_global has no fast path.) bool push_slow(E t, uint dirty_n_elems); - bool pop_local_slow(uint localBot, Age oldAge); + bool pop_local_slow(uint localBot, Age oldAge, idx_t tp); public: typedef E element_type; diff -r e943ff4a475a src/hotspot/share/gc/shared/taskqueue.inline.hpp --- a/src/hotspot/share/gc/shared/taskqueue.inline.hpp Tue Aug 06 08:47:32 2019 +0800 +++ b/src/hotspot/share/gc/shared/taskqueue.inline.hpp Tue Aug 06 11:55:25 2019 +0800 @@ -119,7 +119,7 @@ // gets the last task or in pop_global() if the queue wraps (top == 0 // and pop_global() succeeds, see pop_global()). template -bool GenericTaskQueue::pop_local_slow(uint localBot, Age oldAge) { +bool GenericTaskQueue::pop_local_slow(uint localBot, Age oldAge, idx_t tp) { // This queue was observed to contain exactly one element; either this // thread will claim it, or a competing "pop_global". In either case, // the queue will be logically empty afterwards. Create a new Age value @@ -129,6 +129,9 @@ // then have the owner thread do a pop followed by another push. Without // the incrementing of "tag", the pop_global's CAS could succeed, // allowing it to believe it has claimed the stale element.) + if (oldAge.top() < tp) { + tty->print_cr("unreasonable oldAge: oldAge.top = %d, tp = %d, localBot = %d, N = %d", oldAge.top(), tp, localBot, N); + } Age newAge((idx_t)localBot, oldAge.tag() + 1); // Perhaps a competing pop_global has already incremented "top", in which // case it wins the element. @@ -184,7 +187,7 @@ } else { // Otherwise, the queue contained exactly one element; we take the slow // path. - return pop_local_slow(localBot, _age.get()); + return pop_local_slow(localBot, _age.get(), tp); } }