Skip to content
Permalink
Browse files
8275226: Shenandoah: Relax memory constraint for worker claiming task…
…s/ranges

Backport-of: 3b0b6adc3d547fcf4b971536d2404c342d18046f
  • Loading branch information
shipilev committed Nov 22, 2021
1 parent 01a9e63 commit 716eeb06a81a6533f4bca5ff5495f9178b60d487
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
@@ -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()) {
@@ -499,7 +499,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;
@@ -526,7 +526,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;
@@ -464,14 +464,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);

1 comment on commit 716eeb0

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 716eeb0 Nov 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.