[ 2.5.26-rmap-5-slablru 18-Jul-2002 22:35 40k ]
This is a port of Ed Tomlinson's (firstname.lastname@example.org) really nifty patch to
let the (full) rmap VM do the work of freeing (inode/dentry/dquot) slab
pages based on page aging.
Summary: The slab pages are moved into the active list, where they are
aged and pruned. The rate of pruning is simply the rate we see entries
for these slabs in refill_inactive_zone (while scanning the active list
for pages to deactivate). This has the significant advantage of being
wholly self-tuning! If we can count a slab page as fully pruned and no
longer in use, it is freed. For non-lru slab caches, we occasionally call
kmem_cache_shrink to keep those caches in check. A final sweep though
kmem_cache_reap() is our last protection against OOM.
The only significant structural change to the patch is 2.5's invocation of the inode caches per-filesystem. I have given each fs's inode cache a pruner method during its allocation (a one-line change). Filesystems edited:
fs/adfs/super.c | 1 fs/affs/super.c | 1 fs/bfs/inode.c | 1 fs/coda/inode.c | 2 fs/efs/super.c | 1 fs/ext2/super.c | 1 fs/ext3/super.c | 1 fs/fat/inode.c | 1 fs/freevxfs/vxfs_super.c | 4 fs/hfs/super.c | 1 fs/hpfs/super.c | 1 fs/isofs/inode.c | 1 fs/jffs2/super.c | 1 fs/jfs/super.c | 1 fs/minix/inode.c | 1 fs/ncpfs/inode.c | 1 fs/nfs/inode.c | 1 fs/ntfs/super.c | 2 fs/proc/inode.c | 1 fs/qnx4/inode.c | 1 fs/reiserfs/super.c | 1 fs/romfs/inode.c | 1 fs/smbfs/inode.c | 1 fs/sysv/inode.c | 1 fs/udf/super.c | 1 fs/ufs/super.c | 1
Intermezzo has a funky dentry cache that may need a pruner method (??), but I didn't touch it. If there was a better way to do this, I was too blind to see it.
This patch has been well tested with ext3 and the generic slab caches. I expect the other filesystems' inode caches to behave correctly, but it wouldn't hurt to test! ... ;)
I haven't benchmarked the patch quantitatively, but the balance of eviction between nonslab and slab pages seems to scale with the age of the pages. Slocate runs don't evict the desktop, but do evict cold daemons and other cruft. New allocations for applications shrink the older slabs accordingly. Seems sane. By comparison, plain rmap-13b plunders the slab caches rather ruthlessly.
The overhead for putting these pages on the lru lists, and the hopeful benefits for properly aging and evicting them, should be benchmarked sometime.
Give it a try! :)
Craig Kulesa Steward Observatory Univ. of Arizona
- 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/