Skip to content

bump number of GC threads to the number of compute threads (as opposed to half of it) #53608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/threading.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,14 +708,9 @@ void jl_init_threading(void)
}
else {
// if `--gcthreads` or ENV[NUM_GCTHREADS_NAME] was not specified,
// set the number of mark threads to half of compute threads
// set the number of mark threads to the number of compute threads
// and number of sweep threads to 0
if (nthreads <= 1) {
jl_n_markthreads = 0;
}
else {
jl_n_markthreads = (nthreads / 2) - 1;
}
jl_n_markthreads = nthreads - 1; // -1 for the master (mutator) thread which may also do marking
// if `--gcthreads` or ENV[NUM_GCTHREADS_NAME] was not specified,
// cap the number of threads that may run the mark phase to
// the number of CPU cores
Expand Down
2 changes: 1 addition & 1 deletion test/cmdlineargs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ let exename = `$(Base.julia_cmd()) --startup-file=no --color=no`
# --gcthreads
code = "print(Threads.ngcthreads())"
cpu_threads = ccall(:jl_effective_threads, Int32, ())
@test (cpu_threads == 1 ? "1" : string(div(cpu_threads, 2))) ==
@test string(cpu_threads) ==
read(`$exename --threads auto -e $code`, String) ==
read(`$exename --threads=auto -e $code`, String) ==
read(`$exename -tauto -e $code`, String) ==
Expand Down