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

do not allocate & zero pages until faulted,

to help measure just the map/unmap cost.
上级 cb5aba0f
......@@ -26,10 +26,9 @@ vmnode::vmnode(u64 npg, vmntype ntype, inode *i, u64 off, u64 s)
if (npg > NELEM(page))
panic("vmnode too big\n");
memset(page, 0, npg * sizeof(page[0]));
if (type == EAGER) {
if (type == EAGER && ip) {
assert(allocpg() == 0);
if (ip)
assert(demand_load() == 0);
assert(demand_load() == 0);
}
}
......@@ -416,12 +415,13 @@ vmap::pagefault(uptr va, u32 err)
cprintf("pagefault: err 0x%x va 0x%lx type %d ref %lu pid %d\n",
err, va, m->va_type, m->n->ref.load(), myproc()->pid);
if (m->n && m->n->type == ONDEMAND && m->n->page[npg] == 0) {
if (m->n && !m->n->page[npg])
if (m->n->allocpg() < 0)
panic("pagefault: couldn't allocate pages");
if (m->n && m->n->type == ONDEMAND)
if (m->n->demand_load() < 0)
panic("pagefault: couldn't load");
}
if (m->va_type == COW && (err & FEC_WR)) {
if (pagefault_wcow(m) < 0)
......@@ -468,6 +468,7 @@ vmap::copyout(uptr va, void *p, u64 len)
if(vma == 0)
return -1;
vma->n->allocpg();
uptr pn = (va0 - vma->vma_start) / PGSIZE;
char *p0 = vma->n->page[pn];
if(p0 == 0)
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论