提交 6e31b597 创建 作者: Nickolai Zeldovich's avatar Nickolai Zeldovich

do not assume hardware has NCPU cores; use ncpu where it matters

上级 07cc3f4f
...@@ -76,7 +76,7 @@ migrate(struct proc *p) ...@@ -76,7 +76,7 @@ migrate(struct proc *p)
if (p == myproc()) if (p == myproc())
panic("migrate: myproc"); panic("migrate: myproc");
for (c = 0; c < NCPU; c++) { for (c = 0; c < ncpu; c++) {
if (c == mycpu()->id) if (c == mycpu()->id)
continue; continue;
if (idle[c]) { // OK if there is a race if (idle[c]) { // OK if there is a race
......
...@@ -59,8 +59,8 @@ steal(void) ...@@ -59,8 +59,8 @@ steal(void)
pushcli(); pushcli();
for (i = 1; i < NCPU; i++) { for (i = 1; i < ncpu; i++) {
struct runq *q = &runq[(i+cpunum()) % NCPU]; struct runq *q = &runq[(i+cpunum()) % ncpu];
struct proc *p; struct proc *p;
// XXX(sbw) Look for a process to steal. Acquiring q->lock // XXX(sbw) Look for a process to steal. Acquiring q->lock
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论