Re: [patch 18/21] Filesystem: Socket inode defragmentation

Previous thread: [patch 11/21] inodes: Support generic defragmentation by Christoph Lameter on Friday, May 9, 2008 - 11:08 pm. (1 message)

Next thread: [patch 20/21] dentries: dentry defragmentation by Christoph Lameter on Friday, May 9, 2008 - 11:08 pm. (1 message)
To: <akpm@...>
Cc: <linux-kernel@...>, <netdev@...>, <linux-fsdevel@...>, Mel Gorman <mel@...>, <andi@...>, Rik van Riel <riel@...>, Pekka Enberg <penberg@...>, <mpm@...>
Date: Friday, May 9, 2008 - 11:08 pm

Support inode defragmentation for sockets

Cc: netdev@vger.kernel.org
Reviewed-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
net/socket.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/net/socket.c b/net/socket.c
index 9d3fbfb..205f450 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -269,6 +269,12 @@ static void init_once(struct kmem_cache *cachep, void *foo)
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",
@@ -280,6 +286,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;
}

--
1.5.4.4

--
--

To: Christoph Lameter <clameter@...>
Cc: <akpm@...>, <linux-kernel@...>, <netdev@...>, <linux-fsdevel@...>, Mel Gorman <mel@...>, <andi@...>, Rik van Riel <riel@...>, Pekka Enberg <penberg@...>, <mpm@...>
Date: Tuesday, May 13, 2008 - 9:28 am

Hi Christoph.

Out of curiosity, how can you drop socket inode, since it is always
attached to socket which is removed automatically when connection is
closed. Any force of dropping socket inode can only result in connection
drop, i.e. there are no inodes, which are placed in cache and are not
yet freed, if there are no attached sockets.

So question is how does it work for sockets?

--
Evgeniy Polyakov
--

To: Evgeniy Polyakov <johnpol@...>
Cc: <akpm@...>, <linux-kernel@...>, <netdev@...>, <linux-fsdevel@...>, Mel Gorman <mel@...>, <andi@...>, Rik van Riel <riel@...>, Pekka Enberg <penberg@...>, <mpm@...>
Date: Thursday, May 15, 2008 - 1:40 pm

All inodes are inactivated and put on a lru before they are freed. Those
could be reclaimed by inode defrag. Socket inode defrag is not that
important. Just shows that this can be applied in a general way.

--

To: Christoph Lameter <clameter@...>
Cc: <akpm@...>, <linux-kernel@...>, <netdev@...>, <linux-fsdevel@...>, Mel Gorman <mel@...>, <andi@...>, Rik van Riel <riel@...>, Pekka Enberg <penberg@...>, <mpm@...>
Date: Thursday, May 15, 2008 - 2:23 pm

I have to check my memory, but iput()->destroy_inode() highlights first for sockets...

--
Evgeniy Polyakov
--

Previous thread: [patch 11/21] inodes: Support generic defragmentation by Christoph Lameter on Friday, May 9, 2008 - 11:08 pm. (1 message)

Next thread: [patch 20/21] dentries: dentry defragmentation by Christoph Lameter on Friday, May 9, 2008 - 11:08 pm. (1 message)