kernel - Cleanup token code, add simple exclusive priority (2)
* The priority mechanism revealed an issue with lwkt_switch()'s
fall-back code in dealing with contended tokens. The code was
refusing to schedule a lower-priority thread on a cpu requesting an
exclusive lock as another on that same cpu requesting a shared lock.
This creates a problem for the exclusive priority feature. More
pointedly, it also creates a fairness problem in the mixed lock
type use case generally.
* Change the mechanism to allow any thread polling on tokens to be
scheduled. The scheduler will still iterate in priority order.
This imposes a little extra overhead with regards to userspace
returns as a thread might be scheduled that then tries to return
to userland without being the designated user thread.
* This also fixes another bug that cropped up recently where a
32-way threaded program would sometimes not quickly schedule to
all 32 cpus, sometimes leaving one or two cpus idle for a few
seconds.