Skip to content

Commit

Permalink
steal from all at the end
Browse files Browse the repository at this point in the history
  • Loading branch information
d-netto committed Feb 9, 2023
1 parent e789fc6 commit 145db71
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2582,14 +2582,19 @@ void gc_mark_loop_worker(jl_ptls_t ptls)
goto pop;
}
steal : {
// Steal from a random victim
for (int i = 0; i < 2 * gc_n_threads; i++) {
uint32_t v = cong(UINT64_MAX, UINT64_MAX, &ptls->rngseed) % gc_n_threads;
jl_gc_markqueue_t *mq2 = &gc_all_tls_states[v]->mark_queue;
new_obj = gc_markqueue_steal_from(mq2);
if (new_obj != NULL)
goto mark;
}
for (int i = 0; i < gc_n_threads; i++) {
jl_gc_markqueue_t *mq2 = &gc_all_tls_states[i]->mark_queue;
new_obj = gc_markqueue_steal_from(mq2);
if (new_obj != NULL)
goto mark;
}
}
gc_drain_own_chunkqueue(ptls, mq);
jl_atomic_fetch_add(&gc_n_threads_marking, -1);
Expand Down

0 comments on commit 145db71

Please sign in to comment.