summaryrefslogtreecommitdiff
path: root/sys/src/9/port/proc.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2020-12-22 16:29:55 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2020-12-22 16:29:55 +0100
commit29f60cace1a71edd730c60ddac8dfbd962741038 (patch)
tree11967087ec1657d52a90c7508cf73e2e1bcc9307 /sys/src/9/port/proc.c
parent2fb5fbbd73a1c861bdc7326ece8035ffb35f7093 (diff)
kernel: avoid palloc lock during mmurelease()
Previously, mmurelease() was always called with palloc spinlock held. This is unneccesary for some mmurelease() implementations as they wont release pages to the palloc pool. This change removes pagechainhead() and pagechaindone() and replaces them with just freepages() call, which aquires the palloc lock internally as needed. freepages() avoids holding the palloc lock while walking the linked list of pages, avoding some lock contention.
Diffstat (limited to 'sys/src/9/port/proc.c')
-rw-r--r--sys/src/9/port/proc.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/sys/src/9/port/proc.c b/sys/src/9/port/proc.c
index a51232d44..567ab0756 100644
--- a/sys/src/9/port/proc.c
+++ b/sys/src/9/port/proc.c
@@ -81,27 +81,21 @@ schedinit(void) /* never returns */
case Moribund:
up->state = Dead;
edfstop(up);
- if(up->edf != nil)
+ if(up->edf != nil){
free(up->edf);
- up->edf = nil;
+ up->edf = nil;
+ }
- /*
- * Holding locks from pexit:
- * procalloc
- * palloc
- */
mmurelease(up);
- unlock(&palloc);
- updatecpu(up);
+ lock(&procalloc);
up->mach = nil;
-
up->qnext = procalloc.free;
procalloc.free = up;
-
/* proc is free now, make sure unlock() wont touch it */
up = procalloc.Lock.p = nil;
unlock(&procalloc);
+
sched();
}
coherence();
@@ -1223,10 +1217,6 @@ pexit(char *exitstr, int freemem)
}
qunlock(&up->seglock);
- /* Sched must not loop for these locks */
- lock(&procalloc);
- lock(&palloc);
-
edfstop(up);
up->state = Moribund;
sched();