From 57d3dfd0d4b6574bfcbacf0148c87e69a91bd6ac Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Thu, 19 Aug 1993 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1993-08-19 --- port/devcons.c | 1 + port/fault.c | 2 +- port/page.c | 1 + port/portfns.h | 1 + port/qio.c | 35 +++++++++++++++++++++++++++++------ 5 files changed, 33 insertions(+), 7 deletions(-) diff --git a/port/devcons.c b/port/devcons.c index 5ac930f241e67cebe4c7fc5850b919aa45eebdb9..baca6c50f79c2766b657ee8e750eaa2acc76c3e4 100644 --- a/port/devcons.c +++ b/port/devcons.c @@ -181,6 +181,7 @@ echo(Rune r, char *buf, int n) break; /* pass it on */ case 'x': xsummary(); + ixsummary(); break; case 'b': bitdebug(); diff --git a/port/fault.c b/port/fault.c index 583b21c6422bb6cbe5ca24ad583e5ba5f59a2193..3ada537df679a66cbfc4378c42f28ce6f30065ba 100644 --- a/port/fault.c +++ b/port/fault.c @@ -102,7 +102,7 @@ fixfault(Segment *s, ulong addr, int read, int doputmmu) goto done; if(read && conf.copymode == 0) { - mmuphys = PPN((*pg)->pa) | PTERONLY|PTEVALID; + mmuphys = PPN((*pg)->pa) | /*PTERONLY|*/PTEVALID; (*pg)->modref |= PG_REF; break; } diff --git a/port/page.c b/port/page.c index 1a7bd794165082a8553aab58ce7685a639c8bc84..149bef84a4a65fe9f1a70531a93774068a2fd92d 100644 --- a/port/page.c +++ b/port/page.c @@ -363,6 +363,7 @@ lookpage(Image *i, ulong daddr) { Page *f; +return 0; lock(&palloc.hashlock); for(f = pghash(daddr); f; f = f->hash) { if(f->image == i && f->daddr == daddr) { diff --git a/port/portfns.h b/port/portfns.h index 0f07d8d301e286eb815adf3e0a06c1dc6dcc41d7..60514b90dcca118d0aeb941626022cee88c77239 100644 --- a/port/portfns.h +++ b/port/portfns.h @@ -97,6 +97,7 @@ void invalidateu(void); void isdir(Chan*); int iseve(void); int ispages(void*); +void ixsummary(void); void kbdclock(void); int kbdcr2nl(Queue*, int); int kbdputc(Queue*, int); diff --git a/port/qio.c b/port/qio.c index 14a9104df9948e2907ef2348429610614cd0706d..8a2618b342b6e10deef77e1e70dfe82cc9fd22e7 100644 --- a/port/qio.c +++ b/port/qio.c @@ -30,6 +30,7 @@ struct Chunkl int have; int goal; int hist; + int wanted; }; struct Arena @@ -141,19 +142,24 @@ iallockproc(void *arg) * start giving blocks back to the general pool */ if(cl->have >= cl->goal){ - cl->hist = ((cl->hist<<1) | 1) & 0xff; - if(cl->hist == 0xff && cl->goal > 8) + cl->hist = ((cl->hist<<1) | 1) & 0xffff; + if(cl->hist == 0xffff && cl->goal > 32) cl->goal--; continue; } else cl->hist <<= 1; /* - * increase goal if we've been drained, decrease - * goal if we've had lots of blocks twice in a row. + * increase goal if we've been drained. */ - if(cl->have == 0) - cl->goal += cl->goal>>2; + if(cl->have == 0){ + i = cl->goal>>2; + if(cl->wanted > i) + cl->goal += cl->wanted; + else + cl->goal += i; + cl->wanted = 0; + } first = 0; l = &first; @@ -166,6 +172,7 @@ iallockproc(void *arg) *l = p; l = &p->next; } + i -= x; if(first){ x = splhi(); lock(cl); @@ -194,6 +201,20 @@ iallocinit(void) kproc("ialloc", iallockproc, 0); } +void +ixsummary(void) +{ + int pow; + Chunkl *cl; + + print("size have/goal\n"); + for(pow = Minpow; pow <= Maxpow; pow++){ + cl = &arena.alloc[pow]; + print("%d %d/%d\n", 1<have, cl->goal); + } + print("\n"); +} + Block* iallocb(int size) { @@ -209,7 +230,9 @@ iallocb(int size) lock(cl); p = cl->first; if(p == 0){ + cl->wanted++; unlock(cl); + wakeup(&arena.r); return 0; } cl->have--;