ref: ca59246091915eb88599c0f0e76cb0029a0a7349
dir: /page-rice/
diff 6f9838a6a5b80e0253bdc8fb194ad6f15eb655f5 uncommitted --- a//sys/src/cmd/page.c +++ b//sys/src/cmd/page.c @@ -898,10 +898,6 @@ { int fd; - qlock(&lru); - llinkhead(p); - qunlock(&lru); - if(p->open != nil && p->image == nil){ fd = openpage(p); if(fd >= 0){ @@ -951,7 +947,11 @@ loadpages(Page *p, int oviewgen) { while(p != nil && viewgen == oviewgen){ - qlock(p); + qlock(&lru); + llinkhead(p); + qunlock(&lru); + if(!canqlock(p)) + goto next; loadpage(p); if(viewgen != oviewgen){ unloadpage(p); @@ -972,6 +972,7 @@ unlockdisplay(display); } qunlock(p); + next: if(p != current && imemsize >= imemlimit) break; /* only one page ahead once we reach the limit */ if(forward < 0){ @@ -1309,16 +1310,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 */ @@ -1691,6 +1693,8 @@ addpage(root, "stdin", popenfile, strdup("/fd/0"), -1); for(; *argv; argv++) addpage(root, *argv, popenfile, strdup(*argv), -1); + for(i=0; i<NPROC-1; i++) /* rice */ + showpage1(current); drawlock(1); for(;;){