ref: 39321d74d876356004c5314fbeb58fdaa36545aa
parent: 381da3192f22f6e4909f7a093776e91ba6a9f93b
author: cinap_lenrek <[email protected]>
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 };