vfs: avoid call to inode_lru_list_del() if possible
authorEric Dumazet <eric.dumazet@gmail.com>
Thu, 28 Jul 2011 04:55:13 +0000 (06:55 +0200)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 1 Aug 2011 05:41:17 +0000 (01:41 -0400)
inode_lru_list_del() is expensive because of per superblock lru locking,
while some inodes are not in lru list.

Adding a check in iput_final() can speedup pipe/sockets workloads on
SMP.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/inode.c

index e445be2a18f978a874381022620ad8bee4560071..5aab80dc008cf681e64f47a32759055bc013b13f 100644 (file)
@@ -1330,7 +1330,8 @@ static void iput_final(struct inode *inode)
        }
 
        inode->i_state |= I_FREEING;
-       inode_lru_list_del(inode);
+       if (!list_empty(&inode->i_lru))
+               inode_lru_list_del(inode);
        spin_unlock(&inode->i_lock);
 
        evict(inode);