Slab defragmentation: Support inode defragmentation for sockets Signed-off-by: Christoph Lameter --- net/socket.c | 8 ++++++++ 1 file changed, 8 insertions(+) Index: linux-2.6/net/socket.c =================================================================== --- linux-2.6.orig/net/socket.c 2007-07-29 13:59:52.000000000 -0700 +++ linux-2.6/net/socket.c 2007-07-29 14:45:36.000000000 -0700 @@ -264,6 +264,12 @@ static void init_once(void *foo, struct inode_init_once(&ei->vfs_inode); } +static void *sock_get_inodes(struct kmem_cache *s, int nr, void **v) +{ + return fs_get_inodes(s, nr, v, + offsetof(struct socket_alloc, vfs_inode)); +} + static int init_inodecache(void) { sock_inode_cachep = kmem_cache_create("sock_inode_cache", @@ -275,6 +281,8 @@ static int init_inodecache(void) init_once); if (sock_inode_cachep == NULL) return -ENOMEM; + kmem_cache_setup_defrag(sock_inode_cachep, + sock_get_inodes, kick_inodes); return 0; }