linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] shrink dentry cache before inode cache
@ 2006-03-01 17:07 Cliff Wickman
  2006-03-01 22:12 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Cliff Wickman @ 2006-03-01 17:07 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm

The shrink_slab() function must often be called twice to get significant
slab cache reduction.

shrink_slab() walks the shrinker_list to call functions that can
release kernel slab memory.

The shrinker_list is walked head to tail and, as it is now, comes across the
inode cache shrinker first.  This releases inodes found on the inode_unused 
list.  Afterwards the dentry cache shrinker moves many freeable inodes to 
the list.  But those inodes are not freed until a second invocation of 
shrink_slab().

The dentry cache shrinker (shrink_dcache_memory()) should run before 
the inode cache shrinker (shrink_icache_memory()).

This can be accomplished by queuing the dentry cache shrinker earlier -
simply calling inode_init() before dcache_init().

Diffed against 2.6.15-rc5

Signed-off-by: Cliff Wickman <cpw@sgi.com>
---
 fs/dcache.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)

Index: linux-2.6.16-rc5/fs/dcache.c
===================================================================
--- linux-2.6.16-rc5.orig/fs/dcache.c
+++ linux-2.6.16-rc5/fs/dcache.c
@@ -1738,8 +1738,11 @@ void __init vfs_caches_init(unsigned lon
 	filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0,
 			SLAB_HWCACHE_ALIGN|SLAB_PANIC, filp_ctor, filp_dtor);
 
-	dcache_init(mempages);
 	inode_init(mempages);
+	dcache_init(mempages); /* place after inode_init so that the dentry
+				  cache shrink goes onto the shrinker list
+				  before the inode cache shrink;
+				  freeing dentry's does iput's of inodes */
 	files_init(mempages);
 	mnt_init(mempages);
 	bdev_cache_init();
-- 
Cliff Wickman
Silicon Graphics, Inc.
cpw@sgi.com
(651) 683-3824

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-03-01 22:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-01 17:07 [PATCH 1/1] shrink dentry cache before inode cache Cliff Wickman
2006-03-01 22:12 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox