diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2023-07-11 08:54:30 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2023-07-11 08:54:30 -0400 |
commit | 1c76857397100142295f15abebe84f7f26daa6f5 (patch) | |
tree | 6e2e42537df51c2a83bdd5a9d75959eb22eb66dc /src | |
parent | 739317470873422c1023eab22c570c374a10f498 (diff) | |
download | bfs-1c76857397100142295f15abebe84f7f26daa6f5.tar.xz |
eval: Don't oversubscribe the CPU by default
Diffstat (limited to 'src')
-rw-r--r-- | src/eval.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1548,8 +1548,8 @@ done: static int infer_nproc(void) { long nproc = sysconf(_SC_NPROCESSORS_ONLN); - if (nproc < 0) { - nproc = 0; + if (nproc < 1) { + nproc = 1; } else if (nproc > 8) { // Not much speedup after 8 threads nproc = 8; @@ -1651,7 +1651,7 @@ int bfs_eval(const struct bfs_ctx *ctx) { if (ctx->threads > 0) { nthreads = ctx->threads - 1; } else { - nthreads = infer_nproc(); + nthreads = infer_nproc() - 1; } struct bftw_args bftw_args = { |