shithub: riscv

Download patch

ref: 29e9c7bf0110eac1747e6a0d65a1cff5a6857454
parent: 02015f69f6cf7630015f26b349076fe7b9e76de1
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Jan 3 23:33:29 EST 2024

kernel: don't sched() for clock interrupt when up->state != Running

When we get a clock interrupt, we should not
call sched() when the process is not in "Running" state
as it is already committed to call sched() itself.

(An example is qlock(), just after the unlock() call).

As this is basically the same check as done in
preempted(), unify both and add a "clockintr"
argument to preempted().

Then most trap handlers just become:

preempted(irq());

Also, we do not want to call preempted() for traps,
as the trap handler has just setup some machine
state to resolve the trap. We can wait for the
clock interrupt if we really need the preempt.