kernel - lwkt_token revamp
* Simplify the token API. Hide the lwkt_tokref mechanics and simplify
the lwkt_gettoken()/lwkt_reltoken() API to remove the need to declare
and pass a lwkt_tokref along with the token.
This makes tokens operate more like locks. There is a minor restriction
that tokens must be unlocked in exactly the reverse order they were locked
in, and another restriction limiting the maximum number of tokens a thread
can hold to defined value (32 for now).
The tokrefs are now an array embedded in the thread structure.
* Improve performance when blocking and unblocking threads with recursively
held tokens.
* Improve performance when acquiring the same token recursively. This
operation is now O(1) and requires no locks or critical sections of any
sort.
This will allow us to acquire redundant tokens in deep call paths
without having to worry about performance issues.
* Add a flags field to the lwkt_token and lwkt_tokref structures and add
a flagged feature which will acquire the MP lock along with a particular
token. This will be used as a transitory mechanism in upcoming MPSAFE
work.
The mplock feature in the token structure can be directly connected
to a mpsafe sysctl without being vulnerable to state-change races.
45 files changed: