9front - general discussion about 9front
 help / color / mirror / Atom feed
From: qwx@sciops.net
To: 9front@9front.org
Subject: Re: [9front] page(1) performance fixes
Date: Fri, 14 Jan 2022 18:48:22 +0100	[thread overview]
Message-ID: <5E8402C538447765F6917BA0C9CFAB04@wopr.sciops.net> (raw)
In-Reply-To: <7E69A2A81BDA448578DC8A028CAEC723@felloff.net>

diff 6e64d30454f71ecda88dba1bd792e97509115d73 uncommitted
--- a//sys/src/cmd/page.c
+++ b//sys/src/cmd/page.c
@@ -951,7 +951,8 @@
 loadpages(Page *p, int oviewgen)
 {
 	while(p != nil && viewgen == oviewgen){
-		qlock(p);
+		if(!canqlock(p))
+			goto next;
 		loadpage(p);
 		if(viewgen != oviewgen){
 			unloadpage(p);
@@ -974,6 +975,7 @@
 		qunlock(p);
 		if(p != current && imemsize >= imemlimit)
 			break;		/* only one page ahead once we reach the limit */
+	next:
 		if(forward < 0){
 			if(p->up == nil || p->up->down == p)
 				break;
@@ -1309,16 +1311,17 @@
 	writeaddr(p, "/dev/label");
 	current = p;
 	oviewgen = viewgen;
+	if(nproc >= NPROC)
+		waitpid();
 	switch(rfork(RFPROC|RFMEM)){
 	case -1:
 		sysfatal("rfork: %r");
 	case 0:
 		loadpages(p, oviewgen);
+		nproc--;
 		exits(nil);
 	}
-	if(++nproc >= NPROC)
-		if(waitpid() > 0)
-			nproc--;
+	nproc++;
 }
 
 /* recursive display lock, called from main proc only */
@@ -1693,6 +1696,8 @@
 		addpage(root, *argv, popenfile, strdup(*argv), -1);
 
 	drawlock(1);
+	for(i=0; i<NPROC; i++)		/* rice */
+		showpage(current);
 	for(;;){
 		drawlock(0);
 		i=event(&e);

  reply	other threads:[~2022-01-14 17:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13  1:54 qwx
2022-01-14 11:30 ` cinap_lenrek
2022-01-14 17:48   ` qwx [this message]
2022-01-14 17:54     ` qwx
2022-01-18  1:18       ` qwx

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5E8402C538447765F6917BA0C9CFAB04@wopr.sciops.net \
    --to=qwx@sciops.net \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).