On Fri, Jun 12, 2009 at 07:51:48AM +0200, Otto Moerbeek wrote: > On Thu, Jun 11, 2009 at 03:51:12PM -0600, Bob Beck wrote: > > > > > I could use some assistance in testing this, particularly on some of > > the more odd archetectures. > > > > This diff makes a bunch of changes to the vfs name cache: > > > > 1) it gets rid of the global hash table and reverse hash table for namecahe > > entries. namecache entries > > are now allocated and freed in two global LRU's - one for regular, and > > one for negative entries. > > > > 2) Entries are no longer searched in the global lists, instead they are > > kept track of in the relevant > > vnodes. Since each vnode can be either the parent (directory) vnode of a > > namecache entry, or the target of > > the entry, we keep track of it in both ways in the vnode. We now use a rb > > tree to search the namecache from > > a directory vnode, and keep a list of which entries that we are the target > > vnode. > > > > 3) (most importantly) namecache entries can now be allocated and freed. > > > > 4) cache_purge now actually does something rather than depending on vnode > > horror to work. when recycling a vnode > > cache_purge will now correctly clear the name cache entries associated with > > the vnode. (before it basically > > didn't do anything, and depended on us noticing the vnodes were being > > recycled underneath us) > > > > This has been beat on a bunch, and appears not to slow anything down. I > > do require some testing > > and reports on other arch's particularly the likes of sparc, vax, and > > strange things if possible > > > > Thanks, > > -Bob > > What's the reason to move to RB trees? In general they are slower, > have larger memory overhead and cause more memory fragmentation than > hash tables. The last thing is fixed by using pools, but the other two > things remain. >
This is mostly theoretical. Most hash tables are badly sized and have often bad hashing algorithms that tend to cause long linear list. It is also almost impossible to resize the tables easily. > Is it just to be able to grow the cache without extra work? > AFAIK the whole work was done to make the cache more sane. The current version is just insane enough that Bob was crying, shouting and playing with red wine bottles during c2k9. > Just wondering (without having specific knowledge about the namecache)... > -- :wq Claudio