DragonFly kernel List (threaded) for 2008-01
DragonFly BSD
DragonFly kernel List (threaded) for 2008-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: Patch for inode SLIST conversion

From: Michael Neumann <mneumann@xxxxxxxx>
Date: Sun, 20 Jan 2008 01:58:29 +0100

Simon 'corecode' Schubert wrote:
Michael Neumann wrote:
Now, ufs_ihashget doesn't modify the hashtable at all. So why not store a "transaction id" in each hash table bucket, which gets increased by ufs_ihashins and ufs_ihashrem. Then in ufs_ihashget I read in this id *before* calling vget and check afterwards if it has changed. If it is unchanged, I can omit a second pass over the linked list.

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.

Don't know if the overhead is justified. Probably only if it's used
that often.



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