From 1c76857397100142295f15abebe84f7f26daa6f5 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 11 Jul 2023 08:54:30 -0400 Subject: eval: Don't oversubscribe the CPU by default --- src/eval.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/eval.c') 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 = { -- cgit v1.2.3