Skip to content

Commit

Permalink
remove a bunch of 'skip GC threads' checks since they now have tasks (#…
Browse files Browse the repository at this point in the history
…55160)

GC threads now have tasks (since
#53815).
  • Loading branch information
d-netto authored Jul 24, 2024
1 parent 59074fa commit 0055747
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
8 changes: 0 additions & 8 deletions src/gc-stacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,6 @@ JL_DLLEXPORT jl_array_t *jl_live_tasks(void)
size_t l = 0; // l is not reset on restart, so we keep getting more aggressive at making a big enough list everything it fails
restart:
for (size_t i = 0; i < nthreads; i++) {
// skip GC threads since they don't have tasks
if (gc_first_tid <= i && i < gc_first_tid + jl_n_gcthreads) {
continue;
}
jl_ptls_t ptls2 = allstates[i];
if (ptls2 == NULL)
continue;
Expand All @@ -349,10 +345,6 @@ JL_DLLEXPORT jl_array_t *jl_live_tasks(void)
allstates = jl_atomic_load_relaxed(&jl_all_tls_states);
size_t j = 0;
for (size_t i = 0; i < nthreads; i++) {
// skip GC threads since they don't have tasks
if (gc_first_tid <= i && i < gc_first_tid + jl_n_gcthreads) {
continue;
}
jl_ptls_t ptls2 = allstates[i];
if (ptls2 == NULL)
continue;
Expand Down
10 changes: 10 additions & 0 deletions src/gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,16 @@ STATIC_INLINE int gc_is_parallel_collector_thread(int tid) JL_NOTSAFEPOINT
return tid >= gc_first_tid && tid <= gc_last_parallel_collector_thread_id();
}

STATIC_INLINE int gc_is_concurrent_collector_thread(int tid) JL_NOTSAFEPOINT
{
if (jl_n_sweepthreads == 0) {
return 0;
}
int last_parallel_collector_thread_id = gc_last_parallel_collector_thread_id();
int concurrent_collector_thread_id = last_parallel_collector_thread_id + 1;
return tid == concurrent_collector_thread_id;
}

STATIC_INLINE int gc_random_parallel_collector_thread_id(jl_ptls_t ptls) JL_NOTSAFEPOINT
{
assert(jl_n_markthreads > 0);
Expand Down
11 changes: 8 additions & 3 deletions src/stackwalk.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
utilities for walking the stack and looking up information about code addresses
*/
#include <inttypes.h>
#include "gc.h"
#include "julia.h"
#include "julia_internal.h"
#include "threading.h"
Expand Down Expand Up @@ -1215,11 +1216,15 @@ JL_DLLEXPORT void jl_print_task_backtraces(int show_done) JL_NOTSAFEPOINT
size_t nthreads = jl_atomic_load_acquire(&jl_n_threads);
jl_ptls_t *allstates = jl_atomic_load_relaxed(&jl_all_tls_states);
for (size_t i = 0; i < nthreads; i++) {
// skip GC threads since they don't have tasks
if (gc_first_tid <= i && i < gc_first_tid + jl_n_gcthreads) {
jl_ptls_t ptls2 = allstates[i];
if (gc_is_parallel_collector_thread(i)) {
jl_safe_printf("==== Skipping backtrace for parallel GC thread %zu\n", i + 1);
continue;
}
if (gc_is_concurrent_collector_thread(i)) {
jl_safe_printf("==== Skipping backtrace for concurrent GC thread %zu\n", i + 1);
continue;
}
jl_ptls_t ptls2 = allstates[i];
if (ptls2 == NULL) {
continue;
}
Expand Down

0 comments on commit 0055747

Please sign in to comment.