But if it is unused and not recently referenced, there is little benefit
in keeping it around, is there? I suppose there might be some benefit in
moving hot negative dentries to be on the same page as other hot dentries,
and that should be possible. Negative dentries are a special case, though,
in that they are not actually in use, but their presence is a performance
improvement (i.e. not having to look up /usr/bin/ls, /usr/sbin/ls, etc).
Being able to move active entries between slabs is just too hard in
most cases, and the overhead (locking, back references, etc) in doing so
would probably outweigh the benefits of more tightly packed slab caches.
This could be up to the per-page (or per-slab) "try_to_free_page"
callback function to handle though.
I do agree with the assertion that you shouldn't judge the utility of
all objects on the page in which it lives by just the page use, otherwise
you will never free any other entries on a hot page. There should still
be per-item reference bits that give hints on which entries in the slab
should be freed.
For example we can use the following simple algorithm to free pages/entries:
1) Walk slab pages (maybe page LRU order), and if all entries in the page
can be freed, free them and then remove the page from the slab.
This gives the VM a free page to work with, and any entries that
are later reloaded will go to another page.
As a special case for dcache (which would be handled in the dcache
try_to_free_page callback) we could potentially move referenced
negative dentries to another free entry in that slab page in order to
free a page but not take the hit to go out to disk again to recreate
the negative dentry.
2) For slab pages with in-use entries, free some fraction of entries based
on whether the entries have been referenced. There is no point in
freeing all but one of the entries on a page if we can't free the page
in the end, and having a 10% cache page utilization does nobody any good.
Freeing some of the entries gives us free space to add new entries, but
does not discard too many entries when we can't free the pages anyways.
-- Andreas Dilger http://sourceforge.net/projects/ext2resize/ http://www-mddsp.enel.ucalgary.ca/People/adilger/
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to email@example.com More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/