ke: add lock warden

This commit is contained in:
Loïc Grégoire
2026-10-04 11:10:35 -04:00
parent dd2161179d
commit b802919fc2
23 changed files with 496 additions and 49 deletions
+7 -1
View File
@@ -260,7 +260,7 @@ fn init_cpu() linksection(r.init) void {
.status = 0,
.queues = undefined,
},
.queues_lock = .init(),
.queues_lock = .init("runq"),
.idle_queue = undefined,
.steal_work = false,
.load = .init(0),
@@ -1125,6 +1125,12 @@ fn do_switch(cpu: *PerCpu, cur: *ke.Thread, next: *ke.Thread) void {
kep.impl.call_continuation(&next.context, continuation);
}
if (config.warden) {
// The lock will get released through the context switch assembly code,
// start pretending we don't hold it right now.
kep.warden.released(&cur.lock, .Spin);
}
if (relinquish) {
kep.impl.switch_cont_to_normal(&cur.context, &next.context);
} else {