Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: [wrstuden-revivesa] src/sys



Module Name:    src
Committed By:   wrstuden
Date:           Sun Jun  8 14:54:58 UTC 2008

Modified Files:
        src/sys/kern [wrstuden-revivesa]: kern_exit.c kern_sa.c
        src/sys/sys [wrstuden-revivesa]: savar.h

Log Message:
Fix the huge bug in sa_switch(). We were taking p_lock. But p_lock is
an adaptive mutex, so it is possible to block on it. We're in
sleepq_block() here, so we can't do that.

So instead re-add the per-vp mutex ("savp_mutex" and let it be the
only (spin) mutex we take. Also, arrange the code so that most all
of the time the only thread that actually locks savp_mutex is the
blessed thread, so there should be little contention in sa_switch().

Per discussions w/ rmind, revamp how we hold lwps, both in the
"woken and waiting to trigger upcall" case and the lwp cache. Use
a sleepq_t for each, and use savp_mutex for the queue mutex. This makes
all of the logic in sa_switch() MUCH more similar to how we wake threads
in other parts of the kernel. The only extra work is that we reinitialize
thread state at this point (cpu_setfunc()).

A consequence of this is that cached and waiting-for-unblocked-upcall
threads will show up in ps -s. We may change this in the future, we may
not.

Adjust other comments noticed along the way.

Since threads are always visible to ps, exit now doesn't need to clean
them up.


To generate a diff of this commit:
cvs rdiff -r1.208.2.3 -r1.208.2.4 src/sys/kern/kern_exit.c
cvs rdiff -r1.91.2.18 -r1.91.2.19 src/sys/kern/kern_sa.c
cvs rdiff -r1.24.2.7 -r1.24.2.8 src/sys/sys/savar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Home | Main Index | Thread Index | Old Index