summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-05-27 01:04:53 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2013-05-27 01:04:53 +0200
commit24b908be8a3edb75a63683eb5008aba3c9a1bb52 (patch)
tree91720bacbebe2551dcc0be6bcbd4a5b1cbcfd283
parent3e567afed56b92325150f76c6f36646184d6a650 (diff)
downloadplan9front-24b908be8a3edb75a63683eb5008aba3c9a1bb52.tar.xz
kernel: image reclaim pauses
get a bit more verbose about process image exhaustion and make imagreclaim() try to get at least one image on the freelist. use rsrcwait() to notify the state, and call freebroken() in case imagereclaim() couldnt free any images.
-rw-r--r--sys/src/9/port/segment.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/src/9/port/segment.c b/sys/src/9/port/segment.c
index 98e9cbfa0..d3ad7cfbb 100644
--- a/sys/src/9/port/segment.c
+++ b/sys/src/9/port/segment.c
@@ -264,7 +264,10 @@ attachimage(int type, Chan *c, ulong base, ulong len)
while(!(i = imagealloc.free)) {
unlock(&imagealloc);
imagereclaim();
- sched();
+ if(!imagealloc.free){
+ freebroken(); /* can use the memory */
+ resrcwait("no image after reclaim");
+ }
lock(&imagealloc);
}
@@ -328,7 +331,7 @@ imagereclaim(void)
* end of the list (see putpage) so start there and work
* backward.
*/
- for(p = palloc.tail; p && p->image && n<1000; p = p->prev) {
+ for(p = palloc.tail; p && p->image && (n<1000 || !imagealloc.free); p = p->prev) {
if(p->ref == 0 && canlock(p)) {
if(p->ref == 0) {
n++;