DragonFly kernel List (threaded) for 2008-01
Re: Patch for inode SLIST conversion
I think the concept is a perfectly good programming abstraction, though
I have to again caution that it can result in fairly fragile code. It's
definitely not needed for UFS's inode hash because the chain lengths
are so short.
Going back to your token patch... lets simplify it. Get rid of
lwkt_staleref() and lwkt_initstale() entirely. Build the semantics
SOLELY out of lwkt_is_stale(). The definition of lwkt_is_stale() would
* Returns 0 if the token in question had not been temporarily acquired
while we were blocked since our last lwkt_gettoken(), lwkt_gettokref(),
or lwkt_is_stale() call.
* Returns non-zero if it was.
How do you detect the situation? Really simple I think. Augment
the lwkt_token structure with a pointer to the last lwkt_tokref that
acquired it. Get rid of the 64 bit generation counter, it isn't needed.
struct lwkt_tokref *lastref;
Whenever a token is acquired (_lwkt_gettokref()) is called lastref is
set to the tokref. Whenever a token is released lastref is set to NULL.
The special case of the thread scheduler reacquiring the token with
lwkt_getalltokens() would NULL the field out if lastref != tokref,
and otherwise leave the field intact.
What do you think?