Commit f2ee7abf4c40c8e6bffced923a7c01ea2d1f6c97

Authored by Eric Dumazet
Committed by Al Viro
1 parent b12362bdb6

vfs: avoid taking inode_hash_lock on pipes and sockets

Some inodes (pipes, sockets, ...) are not hashed, no need to take
contended inode_hash_lock at dismantle time.

nice speedup on SMP machines on socket intensive workloads.

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

Showing 2 changed files with 11 additions and 4 deletions Side-by-side Diff

... ... @@ -399,12 +399,12 @@
399 399 EXPORT_SYMBOL(__insert_inode_hash);
400 400  
401 401 /**
402   - * remove_inode_hash - remove an inode from the hash
  402 + * __remove_inode_hash - remove an inode from the hash
403 403 * @inode: inode to unhash
404 404 *
405 405 * Remove an inode from the superblock.
406 406 */
407   -void remove_inode_hash(struct inode *inode)
  407 +void __remove_inode_hash(struct inode *inode)
408 408 {
409 409 spin_lock(&inode_hash_lock);
410 410 spin_lock(&inode->i_lock);
... ... @@ -412,7 +412,7 @@
412 412 spin_unlock(&inode->i_lock);
413 413 spin_unlock(&inode_hash_lock);
414 414 }
415   -EXPORT_SYMBOL(remove_inode_hash);
  415 +EXPORT_SYMBOL(__remove_inode_hash);
416 416  
417 417 void end_writeback(struct inode *inode)
418 418 {
... ... @@ -2317,11 +2317,18 @@
2317 2317 extern int file_remove_suid(struct file *);
2318 2318  
2319 2319 extern void __insert_inode_hash(struct inode *, unsigned long hashval);
2320   -extern void remove_inode_hash(struct inode *);
2321 2320 static inline void insert_inode_hash(struct inode *inode)
2322 2321 {
2323 2322 __insert_inode_hash(inode, inode->i_ino);
2324 2323 }
  2324 +
  2325 +extern void __remove_inode_hash(struct inode *);
  2326 +static inline void remove_inode_hash(struct inode *inode)
  2327 +{
  2328 + if (!inode_unhashed(inode))
  2329 + __remove_inode_hash(inode);
  2330 +}
  2331 +
2325 2332 extern void inode_sb_list_add(struct inode *inode);
2326 2333  
2327 2334 #ifdef CONFIG_BLOCK