Simplify reschedule points, mail works now!
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m55s

This commit is contained in:
2026-02-19 18:25:47 +01:00
parent a1730dfdc2
commit 4472ad5bb3
13 changed files with 45 additions and 143 deletions

View File

@@ -157,35 +157,13 @@ static void amd64_intr_exception (struct saved_regs* regs) {
regs->rbx);
if (regs->cs == (GDT_UCODE | 0x03)) {
struct reschedule_ctx rctx = {.entries = NULL, .lock = SPIN_LOCK_INIT};
struct reschedule_ctx rctx = {.reschedule = false, .cpu = NULL};
proc_kill (thiscpu->proc_current, &rctx);
bool reschedule_thiscpu = false;
spin_lock (&rctx.lock);
struct list_node_link *node, *tmp;
list_foreach (rctx.entries, node, tmp) {
struct reschedule_entry* entry = list_entry (node, struct reschedule_entry, link);
struct cpu* cpu = entry->cpu;
if (cpu != thiscpu) {
cpu_request_sched (cpu);
} else {
reschedule_thiscpu = true;
}
list_remove (rctx.entries, &entry->link);
free (entry);
}
spin_unlock (&rctx.lock);
if (reschedule_thiscpu) {
proc_sched ();
}
if (rctx.reschedule)
cpu_request_sched (rctx.cpu);
} else {
__asm__ volatile ("cli");
spin ();
}
}
@@ -215,33 +193,11 @@ void amd64_intr_handler (void* stack_ptr) {
if (irq == NULL)
return;
struct reschedule_ctx rctx = {.entries = NULL, .lock = SPIN_LOCK_INIT};
struct reschedule_ctx rctx = {.reschedule = false, .cpu = NULL};
irq->func (irq->arg, stack_ptr, &rctx);
bool reschedule_thiscpu = false;
spin_lock (&rctx.lock);
struct list_node_link *node, *tmp;
list_foreach (rctx.entries, node, tmp) {
struct reschedule_entry* entry = list_entry (node, struct reschedule_entry, link);
struct cpu* cpu = entry->cpu;
if (cpu != thiscpu) {
cpu_request_sched (cpu);
} else {
reschedule_thiscpu = true;
}
list_remove (rctx.entries, &entry->link);
free (entry);
}
spin_unlock (&rctx.lock);
if (reschedule_thiscpu) {
proc_sched ();
}
if (rctx.reschedule)
cpu_request_sched (rctx.cpu);
}
}