提交 69b12bc9 创建 作者: Austin Clements's avatar Austin Clements

More mtrace un-bit-rotting

Previously, sched always paused call tracing but if it then returned directly because there was nothing else to schedule, call tracing didn't get resumed. We could simply resume tracing in this case, but this fix instead moves the pause *after* the next proc is picked, so that we don't get lots of spurious pause/resume pairs.
上级 523ac2a9
......@@ -55,11 +55,6 @@ sched(void)
panic("sched interruptible");
intena = mycpu()->intena;
myproc()->curcycles += rdtsc() - myproc()->tsc;
if (myproc()->get_state() == ZOMBIE)
mtstop(myproc());
else
mtpause(myproc());
mtign();
struct proc *next = schednext();
if (next == nullptr) {
......@@ -80,6 +75,12 @@ sched(void)
mycpu()->proc = next;
mycpu()->prev = prev;
if (prev->get_state() == ZOMBIE)
mtstop(prev);
else
mtpause(prev);
mtign();
switchvm(next);
next->set_state(RUNNING);
next->tsc = rdtsc();
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论