8275226: Shenandoah: Relax memory constraint for worker claiming tasks/ranges
Reviewed-by: shade
This commit is contained in:
parent
8d9004b7f4
commit
3b0b6adc3d
src/hotspot/share/gc/shenandoah
@ -87,7 +87,7 @@ void ShenandoahParallelCodeHeapIterator::parallel_blobs_do(CodeBlobClosure* f) {
|
||||
int current = count++;
|
||||
if ((current & stride_mask) == 0) {
|
||||
process_block = (current >= _claimed_idx) &&
|
||||
(Atomic::cmpxchg(&_claimed_idx, current, current + stride) == current);
|
||||
(Atomic::cmpxchg(&_claimed_idx, current, current + stride, memory_order_relaxed) == current);
|
||||
}
|
||||
if (process_block) {
|
||||
if (cb->is_alive()) {
|
||||
|
@ -493,7 +493,7 @@ void ShenandoahNMethodTableSnapshot::parallel_blobs_do(CodeBlobClosure *f) {
|
||||
|
||||
size_t max = (size_t)_limit;
|
||||
while (_claimed < max) {
|
||||
size_t cur = Atomic::fetch_and_add(&_claimed, stride);
|
||||
size_t cur = Atomic::fetch_and_add(&_claimed, stride, memory_order_relaxed);
|
||||
size_t start = cur;
|
||||
size_t end = MIN2(cur + stride, max);
|
||||
if (start >= max) break;
|
||||
@ -520,7 +520,7 @@ void ShenandoahNMethodTableSnapshot::concurrent_nmethods_do(NMethodClosure* cl)
|
||||
ShenandoahNMethod** list = _list->list();
|
||||
size_t max = (size_t)_limit;
|
||||
while (_claimed < max) {
|
||||
size_t cur = Atomic::fetch_and_add(&_claimed, stride);
|
||||
size_t cur = Atomic::fetch_and_add(&_claimed, stride, memory_order_relaxed);
|
||||
size_t start = cur;
|
||||
size_t end = MIN2(cur + stride, max);
|
||||
if (start >= max) break;
|
||||
|
@ -453,14 +453,14 @@ void ShenandoahReferenceProcessor::process_references(ShenandoahRefProcThreadLoc
|
||||
void ShenandoahReferenceProcessor::work() {
|
||||
// Process discovered references
|
||||
uint max_workers = ShenandoahHeap::heap()->max_workers();
|
||||
uint worker_id = Atomic::add(&_iterate_discovered_list_id, 1U) - 1;
|
||||
uint worker_id = Atomic::add(&_iterate_discovered_list_id, 1U, memory_order_relaxed) - 1;
|
||||
while (worker_id < max_workers) {
|
||||
if (UseCompressedOops) {
|
||||
process_references<narrowOop>(_ref_proc_thread_locals[worker_id], worker_id);
|
||||
} else {
|
||||
process_references<oop>(_ref_proc_thread_locals[worker_id], worker_id);
|
||||
}
|
||||
worker_id = Atomic::add(&_iterate_discovered_list_id, 1U) - 1;
|
||||
worker_id = Atomic::add(&_iterate_discovered_list_id, 1U, memory_order_relaxed) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,7 @@ T* ParallelClaimableQueueSet<T, F>::claim_next() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
jint index = Atomic::add(&_claimed_index, 1);
|
||||
jint index = Atomic::add(&_claimed_index, 1, memory_order_relaxed);
|
||||
|
||||
if (index <= size) {
|
||||
return GenericTaskQueueSet<T, F>::queue((uint)index - 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user