cpu->proc_current cannot be NULL

This commit is contained in:
2026-03-20 23:54:04 +01:00
parent 187629b228
commit 7fa37ad6d7
8 changed files with 36 additions and 23 deletions

View File

@@ -234,7 +234,7 @@ static struct proc* proc_find_sched (struct cpu* cpu) {
if (!cpu->proc_run_q)
return NULL;
if (cpu->proc_current && cpu->proc_current->cpu_run_q_link.next)
if (cpu->proc_current->cpu_run_q_link.next)
current = cpu->proc_current->cpu_run_q_link.next;
else
current = cpu->proc_run_q;
@@ -282,7 +282,6 @@ retry:
else
spin_unlock (&cpu->lock, fc);
} else {
cpu->proc_current = NULL;
spin_unlock (&cpu->lock, fc);
spin_lock_relax ();
@@ -310,8 +309,6 @@ void proc_kill (struct proc* proc, struct reschedule_ctx* rctx) {
list_remove (cpu->proc_run_q, &proc->cpu_run_q_link);
cpu->proc_run_q_count--;
if (cpu->proc_current == proc)
cpu->proc_current = NULL;
rbtree_delete (&proc_tree, &proc->proc_tree_link);