DragonFly kernel List (threaded) for 2008-01
Re: Patch for inode SLIST conversion
Michael Neumann wrote:
>> This could be an efficient, but not generic solution. I was thinking
>> of something like this: Have a generation counter in the tokens. If
>> you release a token and somebody else aquires it, the generation will
>> change. Have a function lwkt_token_stale() to check whether the token
>> has been used by somebody else since the last check/aquire. How does
>> that sound? This could be applied to different areas in the kernel
>> which use tokens.
> You mean to add a generation field to lwkt_token plus a
> current_generation field to lwkt_tokref?
> lwkt_token_stale(&lock, &token) would then simply check
> for ilock->current_generation == token->generation, and
> lwkt_gettoken() would increase the generation. Alternatively
> a special lwkt_token_inc() could be used to increase the generation.
Not only gettoken, but also the lwkt code that re-obtains tokens. Doing
a manual _inc() defeats the idea.
> Don't know if the overhead is justified. Probably only if it's used
> that often.
Which overhead? Incrementing an integer?