summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-07-11 08:54:30 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-07-11 08:54:30 -0400
commit1c76857397100142295f15abebe84f7f26daa6f5 (patch)
tree6e2e42537df51c2a83bdd5a9d75959eb22eb66dc /src
parent739317470873422c1023eab22c570c374a10f498 (diff)
downloadbfs-1c76857397100142295f15abebe84f7f26daa6f5.tar.xz
eval: Don't oversubscribe the CPU by default
Diffstat (limited to 'src')
-rw-r--r--src/eval.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/eval.c b/src/eval.c
index 56753af..0faf533 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -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 = {