Mark Kettenis <[email protected]> wrote:

> >     /* For user defined stacks (from sendsig). */
> >     if (sp < (vaddr_t)vm->vm_maxsaddr)
> > -           return;
> > +           goto out;
> 
> Since vm_maxsaddr is ummutable, this check can be done without holding
> the lock.  I think that's worth it as it will prevent contention in
> multi-threaded processes as this check will almost always be true for
> anything but the first thread since those will use a user-defined
> stack.

at k2k20 when revamping trap.c, we puzzled about the double check, and
the next day you pointed this out this is lock avoidance for the common
case.

I agree it should remain.  If I recall correctly one of the trap.c was
coded to grab the kernel lock for uvm_fault, release it, and then
re-grab it for uvm_grow.  Such double grabs also seem harmful.

Reply via email to