ref: afdf90a3e04b622dbd80682c8c3c3736aae1e2a3
parent: d71cc97f3a52823360bf2cd68ef3101d54ce4b7a
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Jan 4 20:58:37 EST 2024
kernel: never do sched() in unlock() when not in "Running" state. Some callers of unlock change the process state (such as qlock()) which means they are committed to calling sched() anyway, so no ned to call it internally.
--- a/sys/src/9/port/taslock.c
+++ b/sys/src/9/port/taslock.c
@@ -204,13 +204,13 @@
coherence();
l->key = 0;
- if(up && --up->nlocks == 0 && up->delaysched && islo()){
- /*
- * Call sched if the need arose while locks were held
- * But, don't do it from interrupt routines, hence the islo() test
- */
+ /*
+ * Call sched if the need arose while locks were held
+ * But, don't do it from interrupt routines, hence the islo() test
+ */
+ if(up && --up->nlocks == 0)
+ if(up->state == Running && up->delaysched && islo())
sched();
- }
}
uintptr ilockpcs[0x100] = { [0xff] = 1 };
--
⑨