diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-10-16 16:10:26 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-10-16 16:10:26 +0200 |
commit | fcacce0f2f510b21930052fcc0e07103db33a5b3 (patch) | |
tree | c1af004844b4d5e048b9cde9f07f0eb1b37cd578 /sys/src/9/port/page.c | |
parent | 45b99937be5fe2f2fe485e8769f007086c2809b1 (diff) |
kernel: duppage cleanup
remove the sched() call and retry loop from duppage() and just
drop the page lock, then reacquire it after lock(&palloc).
Diffstat (limited to 'sys/src/9/port/page.c')
-rw-r--r-- | sys/src/9/port/page.c | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/sys/src/9/port/page.c b/sys/src/9/port/page.c index b004152e9..e8c5b6ce0 100644 --- a/sys/src/9/port/page.c +++ b/sys/src/9/port/page.c @@ -264,29 +264,11 @@ auxpage(void) return p; } -static int dupretries = 15000; - void duppage(Page *p) /* Always call with p locked */ { Page *np; int color; - int retries; - - retries = 0; -retry: - /* 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"); - uncachepage(p); - return; - } /* * normal lock ordering is to call @@ -295,14 +277,18 @@ retry: * 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. + * so we check page ref below. */ if(!canlock(&palloc)){ unlock(p); - if(up) - sched(); + lock(&palloc); lock(p); - goto retry; + } + + /* don't dup pages that are shared or have no image */ + if(p->ref != 1 || p->image == nil || p->image->notext){ + unlock(&palloc); + return; } /* No freelist cache when memory is very low */ |