Skip to content

Commit

Permalink
eval: Don't oversubscribe the CPU by default
Browse files Browse the repository at this point in the history
  • Loading branch information
tavianator committed Jul 11, 2023
1 parent 7393174 commit 1c76857
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -1548,8 +1548,8 @@ static int infer_fdlimit(const struct bfs_ctx *ctx, int limit) {
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;
Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit 1c76857

Please sign in to comment.