summaryrefslogtreecommitdiff
path: root/sys/src/9/port/page.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2015-06-15 17:40:47 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2015-06-15 17:40:47 +0200
commit64ed3658d2abe3829f0619e8243c60edcc1d3815 (patch)
treeb90884b17338d65dca57d86924fb01462734f461 /sys/src/9/port/page.c
parentbce2696b17f4891e819958ed9e8f1adf8bdd97dc (diff)
kernel: add pagechaindone() to wakeup processes waiting for memory
we keep the details about palloc in page.c, providing pagechaindone() for mmu code to be called after a series of pagechainhead() calls.
Diffstat (limited to 'sys/src/9/port/page.c')
-rw-r--r--sys/src/9/port/page.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/src/9/port/page.c b/sys/src/9/port/page.c
index 9da07b071..c16044512 100644
--- a/sys/src/9/port/page.c
+++ b/sys/src/9/port/page.c
@@ -71,6 +71,15 @@ pagechainhead(Page *p)
palloc.freecount++;
}
+void
+pagechaindone(void)
+{
+ if(palloc.pwait[0].p != nil && wakeup(&palloc.pwait[0]) != nil)
+ return;
+ if(palloc.pwait[1].p != nil)
+ wakeup(&palloc.pwait[1]);
+}
+
static void
freepages(Page *head, Page *tail, int n)
{
@@ -79,11 +88,7 @@ freepages(Page *head, Page *tail, int n)
palloc.head = head;
palloc.freecount += n;
unlock(&palloc);
-
- if(palloc.pwait[0].p != nil && wakeup(&palloc.pwait[0]) != nil)
- return;
- if(palloc.pwait[1].p != nil)
- wakeup(&palloc.pwait[1]);
+ pagechaindone();
}
int