aboutsummaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2010-01-29 18:38:32 -0500
committerThomas Gleixner <tglx@linutronix.de>2010-04-27 11:32:49 -0400
commita119db1dc3f3a6da86148960937383ce0c162ad4 (patch)
tree8530d8117f5aaa11c10a7984b1ad8aee3143106e /net/socket.c
parent6f22d55b46fbf80b018009ece79f15b8582843e5 (diff)
fs-inode_rcu
RCU free the struct inode. This will allow: - sb_inode_list_lock to be moved inside i_lock because sb list walkers who want to take i_lock no longer need to take sb_inode_list_lock to walk the list in the first place. This will simplify and optimize locking. - eventually, completely write-free RCU path walking. The inode must be consulted for permissions when walking, so a write-free reference (ie. RCU is helpful). - can potentially simplify things a bit in VM land. May not need to take the page lock to get back to the page->mapping. - can remove some nested trylock loops in dcache code todo: convert all filesystems Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: John Stultz <johnstul@us.ibm.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/net/socket.c b/net/socket.c
index 367296ccafbe..371eaf092a31 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -263,12 +263,19 @@ static struct inode *sock_alloc_inode(struct super_block *sb)
263 return &ei->vfs_inode; 263 return &ei->vfs_inode;
264} 264}
265 265
266static void sock_destroy_inode(struct inode *inode) 266static void sock_i_callback(struct rcu_head *head)
267{ 267{
268 struct inode *inode = container_of(head, struct inode, i_rcu);
269 INIT_LIST_HEAD(&inode->i_dentry);
268 kmem_cache_free(sock_inode_cachep, 270 kmem_cache_free(sock_inode_cachep,
269 container_of(inode, struct socket_alloc, vfs_inode)); 271 container_of(inode, struct socket_alloc, vfs_inode));
270} 272}
271 273
274static void sock_destroy_inode(struct inode *inode)
275{
276 call_rcu(&inode->i_rcu, sock_i_callback);
277}
278
272static void init_once(void *foo) 279static void init_once(void *foo)
273{ 280{
274 struct socket_alloc *ei = (struct socket_alloc *)foo; 281 struct socket_alloc *ei = (struct socket_alloc *)foo;