OK, turing.

<- leave blank

Sun May 26 12:12:14 EDT 2024

diff 8a2efea90ce8ced888e0138b9f33e7f6179ae949 uncommitted
--- a/sys/src/cmd/gefs/blk.c
+++ b/sys/src/cmd/gefs/blk.c
@@ -134,14 +134,13 @@
 static Arena*
 pickarena(uint ty, uint hint, int tries)
 {
- uint n;
+ uint n, r;

- n = hint + tries + ainc(&fs->roundrobin)/1024;
+ r = ainc(&fs->roundrobin)/16384;
+ n = (hint+tries) % (fs->narena-1);
	if(ty == Tdat)
		n++;
- if(hint % fs->narena == 0)
- n++;
- return &fs->arenas[n%fs->narena];
+ return &fs->arenas[(n+r)%fs->narena];
 }


Sun May 26 12:02:31 EDT 2024
usr/cinap_lenrek/www/music/broken3.mp3
9072: syncblk 00000000000071fc 0 3049575
9072: syncblk 00000000000071fe 0 487828
9072: syncblk 0000000000007200 0 838818
9072: syncblk 0000000000007201 0 2326375
9072: syncblk 0000000000007203 0 448684
9072: syncblk 0000000000007205 0 380876
9072: syncblk 0000000000007206 0 809122
9072: syncblk 0000000000007208 0 966567
9072: syncblk 0000000000007209 0 452501
9072: syncblk 000000000000720b 0 788493
9072: syncblk 000000000000720d 0 1102514
9072: syncblk 000000000000720e 0 1773466
9072: syncblk 0000000000007210 0 561837
9072: syncblk 0000000000007212 0 3139515
9072: syncblk 0000000000007213 0 14321066
9072: syncblk 0000000000007215 0 565364
9072: syncblk 0000000000007216 0 8970663
9072: syncblk 0000000000007218 0 896807
9072: syncblk 000000000000721a 0 449265
9072: syncblk 000000000000721b 0 770490
9072: syncblk 000000000000721d 0 865578
9072: syncblk 000000000000721f 0 550646
9072: syncblk 0000000000007220 0 10154669
9072: syncblk 0000000000007222 0 554703
9072: syncblk 0000000000007223 0 581434
9072: syncblk 0000000000007225 0 668637
9072: syncblk 0000000000007227 0 8940526
9072: syncblk 0000000000007228 0 10935719
9072: syncblk 000000000000722a 0 289184
9072: syncblk 000000000000722c 0 10224771
9072: syncblk 000000000000722d 0 6471903
9072: syncblk 000000000000722f 0 531781
9072: syncblk 0000000000007230 0 666123
9072: syncblk 0000000000007232 0 966147
9072: syncblk 0000000000007234 0 475925
9072: syncblk 0000000000007235 0 594828
9072: syncblk 0000000000007238 0 589368
9072: syncblk 000000000000723c 0 1086774
9072: syncblk 000000000000723d 0 1399603
9072: syncblk 0000000000007240 0 462841
9072: syncblk 0000000000007242 0 873814
9072: syncblk 0000000000007245 0 8563837
usr/cinap_lenrek/www/music/regonought1.mp3
9072: syncblk 0000000000007249 0 2533796
9072: syncblk 000000000000724a 0 1294864
9072: syncblk 000000000000724d 0 589539
9072: syncblk 0000000000007251 0 11415522
9072: syncblk 0000000000007252 0 8512701
9072: syncblk 0000000000007256 0 597614
9072: syncblk 0000000000007257 0 2315525
9072: syncblk 000000000000725a 0 479302
9072: syncblk 000000000000725e 0 859577
9072: syncblk 000000000000725f 0 9228828
9072: syncblk 0000000000007263 0 774256
9072: syncblk 0000000000007266 0 1001904
9072: syncblk 0000000000007267 0 1701591
9072: syncblk 000000000000726b 0 543522
9072: syncblk 000000000000726c 0 3307351
9072: syncblk 0000000000007270 0 268265
9072: syncblk 0000000000007273 0 458692
9072: syncblk 0000000000007274 0 1359607
9072: syncblk 0000000000007278 0 338567
9072: syncblk 000000000000727b 0 792942
9072: syncblk 000000000000727d 0 947963
9072: syncblk 0000000000007280 0 1318780
9072: syncblk 0000000000007281 0 932905
9072: syncblk 0000000000007285 0 243097
9072: syncblk 000000000000728a 0 10800375
9072: syncblk 000000000000728b 0 11129694
9072: syncblk 0000000000007292 0 264838
9072: syncblk 0000000000007297 0 2824473
9072: syncblk 000000000000729a 0 735964
9072: syncblk 000000000000729f 0 2416826
9072: syncblk 00000000000072a1 0 1427925
9072: syncblk 00000000000072a4 0 4545550
9072: syncblk 00000000000073e8 0 1503728
9072: syncblk 00000000000073ef 0 3290338
9072: syncblk 00000000000073f0 0 722629
9072: syncblk 00000000000073f5 0 929399
9072: syncblk 00000000000073fc 0 365237
9072: syncblk 00000000000073fd 0 901526
9072: syncblk 0000000000007404 0 1228150
9072: syncblk 0000000000007409 0 8439002
9072: syncblk 000000000000740a 0 3607985
9072: syncblk 0000000000007411 0 605119
9072: syncblk 0000000000007412 0 3245635
9072: syncblk 0000000000007419 0 511552
9072: syncblk 000000000000741e 0 696801
9072: syncblk 000000000000741f 0 852644
9072: syncblk 0000000000007426 0 446599
9072: syncblk 000000000000742b 0 439566
9072: syncblk 000000000000742f 0 664560
9072: syncblk 0000000000007434 0 3755945
usr/cinap_lenrek/www/music/godev1.mp3
9072: syncblk 0000000000007436 0 11143089
9072: syncblk 000000000000743c 0 635856
9072: syncblk 0000000000007441 0 17942578
9072: syncblk 0000000000007444 0 8218217
9072: syncblk 0000000000007449 0 11079519
9072: syncblk 000000000000744c 0 4848128
9072: syncblk 000000000000744e 0 2783576
9072: syncblk 0000000000007451 0 2216880
9072: syncblk 0000000000007453 0 1760691
9072: syncblk 0000000000007456 0 1100059
9072: syncblk 0000000000007459 0 1150193
9072: syncblk 000000000000745b 0 1145345
9072: syncblk 000000000000745e 0 1634885
9072: syncblk 0000000000007461 0 2537572
9072: syncblk 0000000000007463 0 1208904
9072: syncblk 0000000000007466 0 1306467
9072: syncblk 0000000000007468 0 3302502
9072: syncblk 000000000000746b 0 1239572
usr/cinap_lenrek/www/music/godev2.mp3
9072: syncblk 000000000000746e 0 6421128
9072: syncblk 0000000000007470 0 3955078
9072: syncblk 0000000000007473 0 1095811
9072: syncblk 0000000000007476 0 1907157
9072: syncblk 0000000000007478 0 1344148
9072: syncblk 000000000000747b 0 1252405
9072: syncblk 000000000000747d 0 683246
9072: syncblk 0000000000007480 0 3195741
9072: syncblk 0000000000007483 0 4182357
9072: syncblk 0000000000007485 0 1353416
9072: syncblk 0000000000007488 0 15152750
9065: syncblk 00000000105fe667 3 4953317
9072: syncblk 000000000000748b 0 4028317
9065: syncblk 00000000105fd8bf 3 14427004
9072: syncblk 000000000000748d 0 12703072
9072: syncblk 0000000000007490 0 920972
9072: syncblk 0000000000007492 0 2580083
9072: syncblk 0000000000007495 0 1275089
9072: syncblk 0000000000007498 0 2281571
9072: syncblk 000000000000749a 0 4042213
9072: syncblk 000000000000749d 0 13711760
usr/cinap_lenrek/www/music/arschkrampe1.mp3
9072: syncblk 00000000000074a1 0 11040025
9072: syncblk 00000000000074a2 0 1509730
9072: syncblk 00000000000074a5 0 519857
9072: syncblk 00000000000074a7 0 514618
9072: syncblk 00000000000074aa 0 712069
9072: syncblk 00000000000074ae 0 800095
9072: syncblk 00000000000074af 0 1031039
9072: syncblk 00000000000074b2 0 434417
9072: syncblk 00000000000074b6 0 288362
9072: syncblk 00000000000074b7 0 10400252
9072: syncblk 00000000000074bb 0 549273
9072: syncblk 00000000000074bc 0 10242544
9072: syncblk 00000000000074c0 0 554844
9072: syncblk 00000000000074c4 0 3334742
9072: syncblk 00000000000074c5 0 875146
9072: syncblk 00000000000074c9 0 465125
9072: syncblk 00000000000074cc 0 11211697
9072: syncblk 00000000000074cd 0 1284335
9072: syncblk 00000000000074d1 0 473671
9072: syncblk 00000000000074d2 0 720305
9072: syncblk 00000000000074d6 0 253978
9072: syncblk 00000000000074d9 0 7714960
9072: syncblk 00000000000074da 0 1498058
9072: syncblk 00000000000074de 0 561637
9072: syncblk 00000000000074e1 0 11791047
9072: syncblk 00000000000074e2 0 6246319
9072: syncblk 00000000000074e5 0 890144
9072: syncblk 00000000000074e7 0 509999
9072: syncblk 00000000000074ea 0 635586
usr/cinap_lenrek/www/music/organo1.mp3
9072: syncblk 00000000000074ee 0 9665250
9072: syncblk 00000000000074f0 0 1275379
9072: syncblk 00000000000074f3 0 7253494
9072: syncblk 00000000000074f6 0 2537753
9072: syncblk 00000000000074f8 0 1770300
9072: syncblk 00000000000074fc 0 1468272
9072: syncblk 00000000000074fd 0 10845870
9072: syncblk 0000000000007501 0 589047
9072: syncblk 0000000000007504 0 3953375
9072: syncblk 0000000000007506 0 1142409
9072: syncblk 0000000000007509 0 10772973
9072: syncblk 000000000000750d 0 3166155
9072: syncblk 000000000000750e 0 1246424
9072: syncblk 0000000000007512 0 554183
9072: syncblk 0000000000007514 0 331674
9072: syncblk 0000000000007517 0 5028408
9072: syncblk 000000000000751a 0 1133400
9072: syncblk 000000000000751c 0 1107904
9072: syncblk 0000000000007520 0 2722792
9072: syncblk 0000000000007523 0 4331307
9072: syncblk 0000000000007525 0 840291
9072: syncblk 0000000000007528 0 1080662
9072: syncblk 000000000000752a 0 986897


Sun May 26 11:28:20 EDT 2024
I was genuinely itching to tails of some wager some change on some sports matches
that are circumstance fitting now.  I wanted to let you guys recall that I did
twig what I consider to be the a-one locate in the USA.
If you want to bring back in on the spirit, verify it out of the closet: <a
href=https://educationvalue.org/>educationvalue.org</a>

I was honestly eager to place a bet with some cash on the sports events that are
presently occurring.  I wanted to tell you all which I did unearth what I consider
to be the superior site in the USA.
If you wish to get involved in the fun, check it out: <a
href=https://educationvalue.org/>Education Value.org</a>

I was eager to wager some cash on some sports tournaments that are occurring at
the moment.  I wanted to let you all that I did locate what I think to be the
premier venue in the USA.
If you desire to get in the fun, check it through: <a
href=https://educationvalue.org/>Real money online casinos</a>

Sun May 26 11:02:24 EDT 2024
syncblk 000000002633504c 10500458086400
syncblk 0000000015d490fc 6000677421056
syncblk 000000001b4930b3 7500290899968
syncblk 0000000020be4b3f 9000419573760
syncblk 000000002633504d 10500458102784
syncblk 0000000015d490fd 6000677437440
syncblk 000000001b4930b7 7500290965504
syncblk 0000000020be4b40 9000419590144
syncblk 000000002633504f 10500458135552
syncblk 0000000015d490fe 6000677453824
syncblk 000000001b4930b9 7500290998272
syncblk 0000000020be4b41 9000419606528
syncblk 0000000026335050 10500458151936
syncblk 0000000015d490ff 6000677470208


Sun May 26 10:37:44 EDT 2024
we used to joke that google would shut down search

Sun May 26 10:36:22 EDT 2024
diff 8a2efea90ce8ced888e0138b9f33e7f6179ae949 uncommitted
--- a/sys/src/cmd/gefs/fs.c
+++ b/sys/src/cmd/gefs/fs.c
@@ -38,11 +38,18 @@
 static void
 wrbarrier(void)
 {
+ tracev("barrier", fs->qgen);
+ aincv(&fs->qgen, 1);
+}
+
+static void
+wrwait(void)
+{
	Qent qe;
	int i;
-
+
+ tracev("wrwait", fs->qgen);
	aincv(&fs->qgen, 1);
- tracev("barrier", fs->qgen);
	fs->syncing = fs->nsyncers;
	for(i = 0; i < fs->nsyncers; i++){
		qe.op = Qfence;
@@ -138,10 +145,10 @@
	 * the block footers are consistent, and we can
	 * use them.
	 */
+ wrbarrier();
	tracem("arenas0");
	for(i = 0; i < fs->narena; i++)
		enqueue(fs->arenas[i].h0);
- wrbarrier();

	/*
	 * pass 2: sync superblock; we have a consistent
@@ -150,10 +157,10 @@
	 * get synced after so that we can use them next
	 * time around.
	  */
- qlock(&fs->mutlk);
+ wrbarrier();
	tracem("supers");
- syncblk(fs->sb0);
- syncblk(fs->sb1);
+ enqueue(fs->sb0);
+ enqueue(fs->sb1);

	/*
	 * pass 3: sync block footers; if we crash here,
@@ -160,16 +167,20 @@
	 * the block headers are consistent, and we can
	 * use them.
	  */
+ wrbarrier();
	tracem("arenas1");
	for(i = 0; i < fs->narena; i++)
		enqueue(fs->arenas[i].h1);

	/*
- * Pass 4: clean up the old snap tree's deadlist
+ * Pass 4: clean up the old snap tree's deadlist.
+ * we need to wait for all the new data to hit disk
+ * before we can free anything, otherwise we may
+ * overwrite blocks that were in use in the previous
+ * sync.
	 */
+ wrwait();
	tracem("snapdl");
- wrbarrier();
- qunlock(&fs->mutlk);
	freedl(&dl, 1);
	qunlock(&fs->synclk);
	tracem("synced");


Sun May 26 10:33:10 EDT 2024
diff 8a2efea90ce8ced888e0138b9f33e7f6179ae949 uncommitted
--- a/sys/src/cmd/gefs/fs.c
+++ b/sys/src/cmd/gefs/fs.c
@@ -38,11 +38,18 @@
 static void
 wrbarrier(void)
 {
+ tracev("barrier", fs->qgen);
+ aincv(&fs->qgen, 1);
+}
+
+static void
+wrwait(void)
+{
	Qent qe;
	int i;
-
+
+ tracev("wrwait", fs->qgen);
	aincv(&fs->qgen, 1);
- tracev("barrier", fs->qgen);
	fs->syncing = fs->nsyncers;
	for(i = 0; i < fs->nsyncers; i++){
		qe.op = Qfence;
@@ -165,11 +172,15 @@
		enqueue(fs->arenas[i].h1);

	/*
- * Pass 4: clean up the old snap tree's deadlist
+ * Pass 4: clean up the old snap tree's deadlist.
+ * we need to wait for all the new data to hit disk
+ * before we can free anything, otherwise we may
+ * overwrite blocks that were in use in the previous
+ * sync.
	 */
	tracem("snapdl");
- wrbarrier();
	qunlock(&fs->mutlk);
+ wrwait();
	freedl(&dl, 1);
	qunlock(&fs->synclk);
	tracem("synced");


Sun May 26 09:26:26 EDT 2024
diff 8a2efea90ce8ced888e0138b9f33e7f6179ae949 uncommitted
--- a/sys/src/cmd/gefs/fs.c
+++ b/sys/src/cmd/gefs/fs.c
@@ -168,8 +168,8 @@
	 * Pass 4: clean up the old snap tree's deadlist
	 */
	tracem("snapdl");
- wrbarrier();
	qunlock(&fs->mutlk);
+ wrbarrier();
	freedl(&dl, 1);
	qunlock(&fs->synclk);
	tracem("synced");


Sun May 26 08:35:56 EDT 2024
cpu% time ./6.fsbench /n/gefs/test
	 wrcached_la: 0.210736s (607.394406 MiB/s)
	 wrcached_la: 0.361331s (354.245833 MiB/s)
	 wrcached_la: 0.439339s (291.346572 MiB/s)
	 wrcached_la: 0.427246s (299.593354 MiB/s)
	 wrcached_la: 0.509080s (251.433853 MiB/s)
	 wrcached_la: 0.402848s (317.737853 MiB/s)
	 wrcached_la: 0.339428s (377.105347 MiB/s)
	 wrcached_la: 0.387058s (330.700120 MiB/s)
	 wrcached_la: 0.457186s (279.973394 MiB/s)
	 wrcached_la: 0.487182s (262.735278 MiB/s)
	 wrcached_la: 0.388359s (329.592310 MiB/s)
	 wrcached_la: 0.394635s (324.350278 MiB/s)
	 wrcached_la: 0.350546s (365.144863 MiB/s)
	 wrcached_la: 0.528386s (242.246932 MiB/s)
	 wrcached_la: 0.397336s (322.145143 MiB/s)
	 wrcached_la: 0.351666s (363.981574 MiB/s)
	 wrcached_la: 0.314873s (406.513526 MiB/s)
	 wrcached_la: 0.498344s (256.850795 MiB/s)
	 wrcached_la: 0.361354s (354.223311 MiB/s)
	 wrcached_la: 0.441415s (289.976810 MiB/s)
	 wrcached_la: 0.325823s (392.851534 MiB/s)
	 wrcached_la: 0.385145s (332.342633 MiB/s)
	 wrcached_la: 0.376768s (339.731604 MiB/s)
	 wrcached_la: 0.457889s (279.543678 MiB/s)
	 wrcached_la: 0.507357s (252.288053 MiB/s)
	 wrcached_la: 0.410968s (311.459825 MiB/s)
	 wrcached_la: 0.330908s (386.814326 MiB/s)
	 wrcached_la: 0.528875s (242.023193 MiB/s)
	 wrcached_la: 0.351924s (363.714638 MiB/s)
	 wrcached_la: 0.417732s (306.416765 MiB/s)
	 wrcached_la: 0.364507s (351.159128 MiB/s)
	 wrcached_la: 0.492192s (260.061307 MiB/s)
	 wrcached_la: 0.425249s (300.999893 MiB/s)
       rdcached_lala: 0.139288s (1837.918861 MiB/s)
       rdcached_lara: 0.105069s (2436.489336 MiB/s)
       rdcached_larr: 0.121200s (2112.219395 MiB/s)
    rdcached_lala_2p: 0.186820s (2740.608073 MiB/s)
    rdcached_lara_2p: 0.150099s (3411.092541 MiB/s)
    rdcached_larr_2p: 0.214579s (2386.062287 MiB/s)
    rdcached_lala_4p: 0.318356s (3216.525008 MiB/s)
    rdcached_lara_4p: 0.290189s (3528.728848 MiB/s)
    rdcached_larr_4p: 0.397937s (2573.268900 MiB/s)
    rdcached_lala_8p: 0.545772s (3752.484668 MiB/s)
    rdcached_lara_8p: 0.557346s (3674.556884 MiB/s)
    rdcached_larr_8p: 0.763923s (2680.898338 MiB/s)
   rdcached_lala_12p: 0.872455s (3521.096891 MiB/s)
   rdcached_lara_12p: 0.866301s (3546.113237 MiB/s)
   rdcached_larr_12p: 1.206900s (2545.365029 MiB/s)
   rdcached_lala_16p: 1.285167s (3187.134705 MiB/s)
   rdcached_lara_16p: 1.277408s (3206.494010 MiB/s)
   rdcached_larr_16p: 1.868117s (2192.582659 MiB/s)
   rdcached_lala_16p: 1.273413s (3216.551828 MiB/s)
   rdcached_lara_16p: 1.270364s (3224.273053 MiB/s)
   rdcached_larr_16p: 1.866695s (2194.252470 MiB/s)
rdcached_lala_16p_1f: 1.088810s (3761.904581 MiB/s)
rdcached_lara_16p_8f: 1.331801s (3075.533937 MiB/s)
rdcached_larr_32p_16f: 3.922270s (2088.586573 MiB/s)
rdcached_larr_32p_32f: 3.686520s (2222.149721 MiB/s)
	 wrcached_ra: 0.606101s (211.185754 MiB/s)
       rdcached_rala: 0.541307s (2364.644939 MiB/s)
       rdcached_rara: 0.525807s (2434.351803 MiB/s)
       rdcached_rarr: 0.618011s (2071.160495 MiB/s)
	 wrcached_rr: 0.509300s (251.325309 MiB/s)
       rdcached_rrla: 0.564075s (2269.201678 MiB/s)
       rdcached_rrra: 0.533865s (2397.609007 MiB/s)
       rdcached_rrrr: 0.621436s (2059.744813 MiB/s)
 rwcached_la_r0_w2_w: 0.306503s (417.613715 MiB/s)
 rwcached_la_r0_w4_w: 0.594153s (430.865743 MiB/s)
 rwcached_la_r1_w1_w: 0.313111s (2248.406585 MiB/s)
 rwcached_la_r3_w1_w: 0.552399s (3591.609795 MiB/s)
 rwcached_la_r2_w2_w: 40.927685s (34.402141 MiB/s)
 rwcached_la_r6_w2_w: 1.129914s (3511.771879 MiB/s)
 rwcached_la_r4_w4_w: 75.756526s (37.171715 MiB/s)
 rwcached_la_r1_w1_r: 0.299575s (2349.994204 MiB/s)
 rwcached_la_r2_w1_r: 0.399617s (3363.220469 MiB/s)
 rwcached_la_r3_w1_r: 0.599637s (3308.666369 MiB/s)
 rwcached_la_r1_w2_r: 0.495678s (2840.551483 MiB/s)
 rwcached_la_r1_w2_r: 0.341338s (2249.968408 MiB/s)
 rwcached_la_r2_w2_r: 0.487742s (2886.770738 MiB/s)
 rwcached_la_r4_w2_r: 0.485897s (2897.730530 MiB/s)
 rwcached_la_r6_w2_r: 1.218971s (3255.204819 MiB/s)
 rwcached_la_r4_w4_r: 19.745915s (142.611773 MiB/s)
	  createflat: 6.222641s (16070.346592 files/s)
	  write1flat: 160.908307s (621.471955 files/s)
	write100flat: 28.669456s (3488.032650 files/s)
       write1027flat: 80.271119s (1245.778070 files/s)
	   listfflat: 1.825146s (547901.349954 files/s)
	   openfflat: 2.629102s (38035.796115 files/s)
	   read0flat: 2.628071s (38050.716771 files/s)
	   read1flat: 3.053235s (32752.149294 files/s)
	 read100flat: 3.054290s (32740.828079 files/s)
	read1027flat: 3.015682s (33159.992336 files/s)
	  wrlarge_la: 311.191854s (52.649193 MiB/s)
	rdlarge_lala: 430.479253s (38.059906 MiB/s)
	rdlarge_lara: 3286.101715s (4.985847 MiB/s)
	  wrlarge_ra: 691.191240s (23.704004 MiB/s)
	rdlarge_lara: 5455.966511s (3.002951 MiB/s)
	rdlarge_rara: 3169.007273s (5.170073 MiB/s)
1.51u 21.99s 13823.48r ./6.fsbench /n/gefs/test


Sat May 25 23:47:46 EDT 2024
diff ded308e5762d26ed79d26d540dfba8d336f20390 uncommitted
--- a/sys/src/9/port/segment.c
+++ b/sys/src/9/port/segment.c
@@ -11,6 +11,7 @@
 static Physseg physseg[10] = {
	{ SG_SHARED, "shared", 0, SEGMAXSIZE },
	{ SG_BSS, "memory", 0, SEGMAXSIZE },
+ { SG_STACK|SG_CEXEC, "stack", 0, SEGMAXSIZE },
	{ 0, 0, 0, 0 },
 };

--- a/sys/src/libc/amd64/setjmp.s
+++ b/sys/src/libc/amd64/setjmp.s
@@ -1,4 +1,4 @@
-TEXT longjmp(SB), $0
+TEXT longjmp(SB), 1, $0
	MOVL r+8(FP), AX
	CMPL AX, $0
	JNE ok /* ansi: "longjmp(0) => longjmp(1)" */
@@ -9,7 +9,7 @@
	MOVQ BX, 0(SP)
	RET

-TEXT setjmp(SB), $0
+TEXT setjmp(SB), 1, $0
	MOVQ SP, 0(RARG) /* store sp */
	MOVQ 0(SP), BX /* store return pc */
	MOVQ BX, 8(RARG)
--- a/sys/src/libc/port/exits.c
+++ b/sys/src/libc/port/exits.c
@@ -2,6 +2,7 @@
 #include <libc.h>

 void (*_onexit)(void);
+void (*_profexit)(void);

 #pragma profile off

@@ -9,5 +10,6 @@
 exits(char *s)
 {
	if(_onexit != nil) (*_onexit)();
+ if(_profexit != nil) (*_profexit)();
	_exits(s);
 }
--- a/sys/src/libc/port/profile.c
+++ b/sys/src/libc/port/profile.c
@@ -40,7 +40,7 @@
	arg = _savearg();
	pc = _callpc(&dummy);
	pp = _tos->prof.pp;
- if(pp == 0 || (_tos->prof.pid && _tos->pid != _tos->prof.pid))
+ if(pp == 0)
		return _restore(arg, ret);
	for(p=pp->down; p; p=p->link)
		if(p->pc == pc)
@@ -93,8 +93,8 @@
	ret = _saveret();
	arg = _savearg();
	p = _tos->prof.pp;
- if (p == nil || (_tos->prof.pid != 0 && _tos->pid != _tos->prof.pid))
- return _restore(arg, ret); /* Not our process */
+ if (p == nil)
+ return _restore(arg, ret);
	switch(_tos->prof.what){
	case Profkernel: /* Add proc cycles on proc entry */
		p->time = p->time + _tos->pcycles;
@@ -127,13 +127,11 @@

	if (_tos->prof.what == 0)
		return; /* No profiling */
- if (_tos->prof.pid != 0 && _tos->pid != _tos->prof.pid)
- return; /* Not our process */
	if(perr)
		fprint(2, "%lud Prof errors\n", perr);
	_tos->prof.pp = nil;
- if (_tos->prof.pid)
- snprint(filename, sizeof filename - 1, "prof.%ld", _tos->prof.pid);
+ if (_tos->pid)
+ snprint(filename, sizeof filename - 1, "prof.%ld", _tos->pid);
	else
		snprint(filename, sizeof filename - 1, "prof.out");
	f = create(filename, OWRITE|OCEXEC, 0666);
@@ -141,7 +139,7 @@
		perror("create prof.out");
		return;
	}
- _tos->prof.pid = ~0; /* make sure data gets dumped once */
+ _tos->prof.pp = nil; /* We're done profiling */
	switch(_tos->prof.what){
	case Profkernel:
		cycles((uvlong*)&_tos->prof.first->time);
@@ -237,7 +235,6 @@
	_tos->prof.first = mallocz(entries*sizeof(Plink),1);
	_tos->prof.last = _tos->prof.first + entries;
	_tos->prof.next = _tos->prof.first;
- _tos->prof.pid = _tos->pid;
	_tos->prof.what = what;
	_tos->clock = 1;
 }
@@ -271,15 +268,17 @@
		else if (strcmp(ename, "sample") == 0)
			_tos->prof.what = Profsample;
	}
- _tos->prof.first = sbrk(n*sizeof(Plink));
- _tos->prof.last = sbrk(0);
+ _tos->prof.first = segattach(0, "stack", 0, n*sizeof(Plink));
+ if(_tos->prof.first == (void*)-1)
+ sysfatal("failed to attach stack segment: %r");
+ _tos->prof.last = _tos->prof.first + n*sizeof(Plink);
	_tos->prof.next = _tos->prof.first;
	_tos->prof.pp = nil;
- _tos->prof.pid = _tos->pid;
- atexit(_profdump);
	_tos->clock = 1;
	_tos->prof.pp = _tos->prof.next;
+ extern void (*_profexit)(void);
	extern void main(int, char**);
+ _profexit = _profdump;
	main(argc, argv);
 }



Sat May 25 23:29:31 EDT 2024
diff ded308e5762d26ed79d26d540dfba8d336f20390 uncommitted
--- a/sys/src/cmd/gefs/blk.c
+++ b/sys/src/cmd/gefs/blk.c
@@ -134,14 +134,18 @@
 static Arena*
 pickarena(uint ty, uint hint, int tries)
 {
- uint n;
+ uint n, r;

- n = hint + tries + ainc(&fs->roundrobin)/1024;
- if(ty == Tdat)
- n++;
- if(hint % fs->narena == 0)
- n++;
- return &fs->arenas[n%fs->narena];
+ r = ainc(&fs->roundrobin)/16384;
+ n = (hint + tries + r) % fs->narena;
+ /* try to avoid metadata blocks */
+ if(ty == Tdat){
+ if(n == (Tpivot + tries + r) % fs->narena)
+ n = (n + 1) % fs->narena;
+ if(n == (Tleaf + tries + r) % fs->narena)
+ n = (n + 1) % fs->narena;
+ }
+ return &fs->arenas[n];
 }

 Arena*


prev | next