diff options
author | cinap_lenrek <cinap_lenrek@rei2.9hal> | 2012-02-16 18:04:08 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@rei2.9hal> | 2012-02-16 18:04:08 +0100 |
commit | 77c21a062c7cf272e59df95955388f9724bff218 (patch) | |
tree | e4b119c82c995eb8dee611c64ed2320d1c0f9971 /sys/src/9/port/page.c | |
parent | 083612b34eb152ea20b31aa5d7fbef1c11e4173e (diff) |
kernel: remove duppage debug, add comments, cleanup
Diffstat (limited to 'sys/src/9/port/page.c')
-rw-r--r-- | sys/src/9/port/page.c | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/sys/src/9/port/page.c b/sys/src/9/port/page.c index abce72a6b..17466ec7a 100644 --- a/sys/src/9/port/page.c +++ b/sys/src/9/port/page.c @@ -266,7 +266,7 @@ auxpage(void) static int dupretries = 15000; -int +void duppage(Page *p) /* Always call with p locked */ { Page *np; @@ -275,32 +275,27 @@ duppage(Page *p) /* Always call with p locked */ retries = 0; retry: - /* don't dup shared page */ - if(p->ref != 1){ - print("duppage: p->ref %d != 1\n", p->ref); - return 0; - } - - /* don't dup pages with no image */ - if(p->image == nil || p->image->notext){ - print("duppage: noimage\n"); - return 0; - } + /* don't dup pages that are shared or have no image */ + if(p->ref != 1 || p->image == nil || p->image->notext) + return; if(retries++ > dupretries){ print("duppage %d, up %p\n", retries, up); dupretries += 100; if(dupretries > 100000) - panic("duppage\n"); + panic("duppage"); uncachepage(p); - return 1; + return; } /* * normal lock ordering is to call * lock(&palloc) before lock(p). * To avoid deadlock, we have to drop - * our locks and try again. + * our locks and try again. as the page + * is from the image cache, this might + * let someone else come in and grab it + * so we check page ref above. */ if(!canlock(&palloc)){ unlock(p); @@ -314,7 +309,7 @@ retry: if(palloc.freecount < swapalloc.highwater) { unlock(&palloc); uncachepage(p); - return 1; + return; } color = getpgcolor(p->va); @@ -326,7 +321,7 @@ retry: if(np == 0) { unlock(&palloc); uncachepage(p); - return 1; + return; } pageunchain(np); @@ -344,7 +339,7 @@ retry: */ lock(np); if(np->ref != 0) /* should never happen */ - panic("duppage: np->ref %d != 0\n", np->ref); + panic("duppage: np->ref %d != 0", np->ref); unlock(&palloc); /* Cache the new version */ @@ -355,8 +350,6 @@ retry: cachepage(np, p->image); unlock(np); uncachepage(p); - - return 0; } void |