kalloc/kfree now only a page at a time

do not keep sorted contiguous free list
This commit is contained in:
Robert Morris 2010-08-31 12:54:47 -04:00
parent 81b30b14d6
commit 7d7dc9331b
9 changed files with 46 additions and 91 deletions

6
proc.c
View file

@ -84,7 +84,7 @@ found:
release(&ptable.lock);
// Allocate kernel stack if possible.
if((p->kstack = kalloc(KSTACKSIZE)) == 0){
if((p->kstack = kalloc()) == 0){
p->state = UNUSED;
return 0;
}
@ -169,7 +169,7 @@ fork(void)
// Copy process state from p.
if (!(np->pgdir = copyuvm(proc->pgdir, proc->sz))) {
kfree(np->kstack, KSTACKSIZE);
kfree(np->kstack);
np->kstack = 0;
np->state = UNUSED;
return -1;
@ -418,7 +418,7 @@ wait(void)
if(p->state == ZOMBIE){
// Found one.
pid = p->pid;
kfree(p->kstack, KSTACKSIZE);
kfree(p->kstack);
p->kstack = 0;
freevm(p->pgdir);
p->state = UNUSED;