Skip to content

Commit 0055747

Browse files
authored
remove a bunch of 'skip GC threads' checks since they now have tasks (#55160)
GC threads now have tasks (since #53815).
1 parent 59074fa commit 0055747

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

src/gc-stacks.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,6 @@ JL_DLLEXPORT jl_array_t *jl_live_tasks(void)
332332
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
333333
restart:
334334
for (size_t i = 0; i < nthreads; i++) {
335-
// skip GC threads since they don't have tasks
336-
if (gc_first_tid <= i && i < gc_first_tid + jl_n_gcthreads) {
337-
continue;
338-
}
339335
jl_ptls_t ptls2 = allstates[i];
340336
if (ptls2 == NULL)
341337
continue;
@@ -349,10 +345,6 @@ JL_DLLEXPORT jl_array_t *jl_live_tasks(void)
349345
allstates = jl_atomic_load_relaxed(&jl_all_tls_states);
350346
size_t j = 0;
351347
for (size_t i = 0; i < nthreads; i++) {
352-
// skip GC threads since they don't have tasks
353-
if (gc_first_tid <= i && i < gc_first_tid + jl_n_gcthreads) {
354-
continue;
355-
}
356348
jl_ptls_t ptls2 = allstates[i];
357349
if (ptls2 == NULL)
358350
continue;

src/gc.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,16 @@ STATIC_INLINE int gc_is_parallel_collector_thread(int tid) JL_NOTSAFEPOINT
478478
return tid >= gc_first_tid && tid <= gc_last_parallel_collector_thread_id();
479479
}
480480

481+
STATIC_INLINE int gc_is_concurrent_collector_thread(int tid) JL_NOTSAFEPOINT
482+
{
483+
if (jl_n_sweepthreads == 0) {
484+
return 0;
485+
}
486+
int last_parallel_collector_thread_id = gc_last_parallel_collector_thread_id();
487+
int concurrent_collector_thread_id = last_parallel_collector_thread_id + 1;
488+
return tid == concurrent_collector_thread_id;
489+
}
490+
481491
STATIC_INLINE int gc_random_parallel_collector_thread_id(jl_ptls_t ptls) JL_NOTSAFEPOINT
482492
{
483493
assert(jl_n_markthreads > 0);

src/stackwalk.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
utilities for walking the stack and looking up information about code addresses
66
*/
77
#include <inttypes.h>
8+
#include "gc.h"
89
#include "julia.h"
910
#include "julia_internal.h"
1011
#include "threading.h"
@@ -1215,11 +1216,15 @@ JL_DLLEXPORT void jl_print_task_backtraces(int show_done) JL_NOTSAFEPOINT
12151216
size_t nthreads = jl_atomic_load_acquire(&jl_n_threads);
12161217
jl_ptls_t *allstates = jl_atomic_load_relaxed(&jl_all_tls_states);
12171218
for (size_t i = 0; i < nthreads; i++) {
1218-
// skip GC threads since they don't have tasks
1219-
if (gc_first_tid <= i && i < gc_first_tid + jl_n_gcthreads) {
1219+
jl_ptls_t ptls2 = allstates[i];
1220+
if (gc_is_parallel_collector_thread(i)) {
1221+
jl_safe_printf("==== Skipping backtrace for parallel GC thread %zu\n", i + 1);
1222+
continue;
1223+
}
1224+
if (gc_is_concurrent_collector_thread(i)) {
1225+
jl_safe_printf("==== Skipping backtrace for concurrent GC thread %zu\n", i + 1);
12201226
continue;
12211227
}
1222-
jl_ptls_t ptls2 = allstates[i];
12231228
if (ptls2 == NULL) {
12241229
continue;
12251230
}

0 commit comments

Comments
 (0)