fix scheduler bug (credit: @xobs)

@xobs found a scheduler bug that would trigger a runnable process
search every time a scalar message returned. This fixes the problem,
causing the quantum to go back to the caller as intended.

Improves performance on the syscall by about 40%.
This commit is contained in:
bunnie 2023-01-17 02:11:48 +08:00
parent aa48476937
commit 7be4a88a9b

View file

@ -653,8 +653,7 @@ impl SystemServices {
let process = self.get_process(pid)?;
if let Some(tid) = tid {
Ok(match process.state {
ProcessState::Running(x) if x & (1 << tid) == 0 => true,
ProcessState::Ready(x) if x & (1 << tid) == 0 => true,
ProcessState::Running(x) | ProcessState::Ready(x) if x & (1 << tid) != 0 => true,
ProcessState::Sleeping => true,
_ => false,
})