diff options
author | Chris Mason <clm@fb.com> | 2023-04-21 07:01:49 -0700 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2023-04-21 07:01:49 -0700 |
commit | c3d60f610700bd1f133e9f6760f4efd3ac875b83 (patch) | |
tree | 4f1f0e9f1b6d3f24fdaa48f3ad64dfd76c126aff | |
parent | 5d6ed2d36c3abd4d59bef658577eb5c94e59be12 (diff) | |
download | schbench-c3d60f610700bd1f133e9f6760f4efd3ac875b83.tar.gz |
schbench: scale down worker threads to num_cpus by default
The default number of worker threads is just num_cpus, but the workers
are per message thread. So if you pass -m 2, you'll end up with 2x the
number of workers, which is a surprise.
This commit changes the default to scale down the workers when -m is
increased. You can still use -t to manually set the worker count.
Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r-- | schbench.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1350,7 +1350,10 @@ int main(int ac, char **av) parse_options(ac, av); if (worker_threads == 0) { - worker_threads = get_nprocs(); + unsigned long num_cpus = get_nprocs(); + + worker_threads = (num_cpus + message_threads - 1) / message_threads; + fprintf(stderr, "setting worker threads to %d\n", worker_threads); } |