From: Andrew Morton When userspace reads a directory or a number of inodes it is very common for the filesystem to be asked to access the same metadata block multiple times in quick succession. Each lookup will run touch_buffer(). As a consequence of this, large amounts of blockdev pagecache end up nailed on the VM's active list, marked as referenced. These pages will cause other active pages to be evicted: mapped executables, swapout, etc. This is probably wrong. The core problem here is that the kernel is treating that sudden burst of accesses to the dirents and inodes as multiple touches. Really we should be treating them as a single touch. So as an experiment, just remove that touch_buffer() call. We don't have any tests to determine the effects of this, and nobody will bother setting one up, so ho hum, this remains in -mm for ever. This change is probably a bit too aggressive - as a followup, filesystems should be taught to run touch_buffer() or mark_page_accessed() against this pagecache on each "independent" access. The problem is, how to determine when they are "independent"? Perhaps "the access was to the first inode in the block" and "the access was to the first directory entry in the block" would suffice. The fs could then implement use-once via: if (first inode in block) { page = find_get_page(...); if (page) mark_page_accessed(page); put_page(page); } I don't think there's any point in doing this until we have some decent testcases. AFACIT ext2 has never run mark_page_accessed() against its directory pagecache, so there is no practical way in which ext2 directories _ever_ find their way onto the inactive list. Nobody appears to have noticed this. touch_buffer() is unused after this patch, but let's retain it for the above reasons. I guess we'll need a new probe_buffer() thing to be able to implement the above use-once algorithm for bh-based metadata. Signed-off-by: Andrew Morton --- fs/buffer.c | 2 -- 1 files changed, 2 deletions(-) diff -puN fs/buffer.c~vm-dont-run-touch_buffer-during-buffercache-lookups fs/buffer.c --- a/fs/buffer.c~vm-dont-run-touch_buffer-during-buffercache-lookups +++ a/fs/buffer.c @@ -1337,8 +1337,6 @@ __find_get_block(struct block_device *bd if (bh) bh_lru_install(bh); } - if (bh) - touch_buffer(bh); return bh; } EXPORT_SYMBOL(__find_get_block); _