Re: Large slab cache in 2.6.1

Martin J. Bligh
2004-02-22T16:11:39Z

--Andrew Morton <akpm@osdl.org> wrote (on Saturday, February 21, 2004 22:15:53 -0800):

> Linus Torvalds <torvalds@osdl.org> wrote:
>>
>> What happened to the experiment of having slab pages on the (in)active
>> lists and letting them be free'd that way? Didn't somebody already do
>> that? Ed Tomlinson and Craig Kulesa?
>
> That was Ed. Because we cannot reclaim slab pages direct from the LRU it
> turned out that putting slab pages onto the LRU was merely an extremely
> complicated way of making the VFS cache scanning rate porportional to the
> pagecache scanning rate. So we ended up doing just that, without putting
> the slab pages on the LRU.

I still don't understand the rationale behind the way we currently do it -
perhaps I'm just being particularly dense. If we have 10,000 pages full of
dcache, and start going through shooting entries by when they were LRU wrt
the entries, not the dcache itself, then (assuming random access to dcache),
we'll evenly shoot the same number of entries from each dcache page without
actually freeing any pages at all, just trashing the cache.

Now I'm aware access isn't really random, which probably saves our arse.
But then some of the entries will be locked too, which only makes things
worse (we free a bunch of entries from that page, but the page itself
still isn't freeable). So it still seems likely to me that we'll blow
away at least half of the dcache entries before we free any significant
number of pages at all. That seems insane to me. Moreover, the more times
we shrink & fill, the worse the layout will get (less grouping of "recently
used entries" into the same page).

Moreover, it seems rather expensive to do a write operation for each
dentry to maintain the LRU list over entries. But maybe we don't do that
anymore with dcache RCU - I lost track of what that does ;-( So doing it
on the page LRU basis still makes a damned sight more sense to me. Don't
we want semantics like "once used vs twice used" preference treatment
for dentries, etc anyway?

If someone has the patience to explain exactly why I'm crazy (on this topic,
not in general) I'd appreciate it ;-)

M.