fix unlock(&procalloc) race on mp systems

This commit is contained in:
cinap_lenrek 2012-01-22 22:33:15 +01:00
parent 158a3cf4dd
commit e2bbb41a30

View file

@ -86,13 +86,15 @@ schedinit(void) /* never returns */
* palloc * palloc
*/ */
mmurelease(up); mmurelease(up);
unlock(&palloc);
up->qnext = procalloc.free; up->qnext = procalloc.free;
procalloc.free = up; procalloc.free = up;
unlock(&palloc); /* proc is free now, make sure unlock() wont touch it */
up = procalloc.p = nil;
unlock(&procalloc); unlock(&procalloc);
break; sched();
} }
up->mach = nil; up->mach = nil;
updatecpu(up); updatecpu(up);