ref: 775be16fc1f2ce15cdf58c273c29cf4dba14cdad
parent: 40a7bbda7392fdc8183678ea82323cded91b14ce
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Oct 30 21:12:50 EDT 2022
main: tweak parallelism, make it scale with cpus we can optimize later, but at least this is using nproc, so it feels like we optimized.
--- a/main.c
+++ b/main.c
@@ -182,8 +182,8 @@
*/
if(nproc < 2)
nproc = 2;
- if(nproc > 6)
- nproc = 6;
+ if(nproc > 8)
+ nproc = 8;
if(ream){
reamfs(dev);
exits(nil);
@@ -193,7 +193,7 @@
fs->rdchan = mkchan(32);
fs->wrchan = mkchan(32);
- fs->nsyncers = 2;
+ fs->nsyncers = nproc/2;
if(fs->nsyncers > fs->narena)
fs->nsyncers = fs->narena;
for(i = 0; i < fs->nsyncers; i++)
@@ -205,7 +205,7 @@
launch(runtasks, -1, nil, "tasks");
launch(runcons, fs->nworker++, (void*)ctlfd, "ctl");
launch(runwrite, fs->nworker++, nil, "mutate");
- for(i = 0; i < 2; i++)
+ for(i = 0; i < nproc/2; i++)
launch(runread, fs->nworker++, nil, "readio");
for(i = 0; i < fs->nsyncers; i++)
launch(runsync, -1, &fs->syncq[i], "syncio");