Skip to content

Commit 3784a00

Browse files
committed
bump number of GC threads to the number of compute threads (as opposed to half of it)
1 parent 2e876fc commit 3784a00

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/threading.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -708,14 +708,9 @@ void jl_init_threading(void)
708708
}
709709
else {
710710
// if `--gcthreads` or ENV[NUM_GCTHREADS_NAME] was not specified,
711-
// set the number of mark threads to half of compute threads
711+
// set the number of mark threads to the number of compute threads
712712
// and number of sweep threads to 0
713-
if (nthreads <= 1) {
714-
jl_n_markthreads = 0;
715-
}
716-
else {
717-
jl_n_markthreads = (nthreads / 2) - 1;
718-
}
713+
jl_n_markthreads = nthreads - 1; // -1 for the master (mutator) thread which may also do marking
719714
// if `--gcthreads` or ENV[NUM_GCTHREADS_NAME] was not specified,
720715
// cap the number of threads that may run the mark phase to
721716
// the number of CPU cores

test/cmdlineargs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ let exename = `$(Base.julia_cmd()) --startup-file=no --color=no`
388388
# --gcthreads
389389
code = "print(Threads.ngcthreads())"
390390
cpu_threads = ccall(:jl_effective_threads, Int32, ())
391-
@test (cpu_threads == 1 ? "1" : string(div(cpu_threads, 2))) ==
391+
@test string(cpu_threads) ==
392392
read(`$exename --threads auto -e $code`, String) ==
393393
read(`$exename --threads=auto -e $code`, String) ==
394394
read(`$exename -tauto -e $code`, String) ==

0 commit comments

Comments
 (0)