shithub: riscv

Download patch

ref: 7144ff2694ab898a8c19188a356ce6f03bb4de2d
parent: b3a26fb633f4649fc202b77c0184184b756960e7
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Mon Apr 8 12:47:30 EDT 2024

kernel: do nlocks && delayshed check only for Running state

If the process called sched to do a procswitch(),
skip the delaysched logic, we definitely do not
want to return here unless we'r in running state.

--- a/sys/src/9/port/proc.c
+++ b/sys/src/9/port/proc.c
@@ -180,8 +180,6 @@
 		/*
 		 * Delay the sched until the process gives up the locks
 		 * it is holding.  This avoids dumb lock loops.
-		 * Don't delay if the process is Moribund.
-		 * It called sched to die.
 		 * But do sched eventually.  This avoids a missing unlock
 		 * from hanging the entire kernel. 
 		 * But don't reschedule procs holding palloc or procalloc.
@@ -192,7 +190,7 @@
 		 * but Lock.p has not yet been initialized.
 		 */
 		if(up->nlocks)
-		if(up->state != Moribund)
+		if(up->state == Running)
 		if(up->delaysched < 20
 		|| palloc.Lock.p == up
 		|| fscache.Lock.p == up