git: 9front

Download patch

ref: 6756597802c0890d163f2b698eabebef13c1cc2e
parent: 99844f8e63ab750786ce25d3384444dd4b216318
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Mon Sep 17 20:53:05 EDT 2018

kernel: fix livelock in rebalance (thanks Richard Miller)

Once a second rebalance() is called on cpu0 to adjust priorities,
so cpu-bound processes won't lock others out.  However it was only
adjusting processes which were running on cpu0.  This was observed
to lead to livelock, eg when a higher-priority process spin-waits
for a lock held by a lower priority one.

--- a/sys/src/9/port/proc.c
+++ b/sys/src/9/port/proc.c
@@ -478,8 +478,6 @@
 		p = rq->head;
 		if(p == nil)
 			continue;
-		if(p->mp != MACHP(m->machno))
-			continue;
 		if(pri == p->basepri)
 			continue;
 		updatecpu(p);
--