Sockets, pipes and anonymous fds have interesting properties. Like other files, they use a dentry and an inode. But dentries for these kind of files are not hashed into dcache, since there is no way someone can lookup such a file in the vfs tree. (/proc/{pid}/fd/{number} uses a different mechanism) Still, allocating and freeing such dentries are expensive processes, because we currently take dcache_lock inside d_alloc(), d_instantiate(), and dput(). This lock is very contended on SMP machines. This patch defines a new DCACHE_SPECIAL flag, to mark a dentry as a special one (for sockets, pipes, anonymous fd), and a new d_alloc_special(const struct qstr *name, struct inode *inode) method, called by the three subsystems. Internally, dput() can take a fast path to dput_special() for special dentries, avoiding an expensive atomic_dec_and_lock() Differences betwen a special dentry and a normal one are : 1) Special dentry has the DCACHE_SPECIAL flag 2) Special dentry's parent are themselves. This to avoid taking a reference on 'root' dentry, shared by too many dentries. 3) They are not hashed into global hash table 4) Their d_alias list is empty (socket8 bench result : from 27.5s to 24s) Signed-off-by: Eric Dumazet --- fs/anon_inodes.c | 16 ------------ fs/dcache.c | 51 +++++++++++++++++++++++++++++++++++++++ fs/pipe.c | 23 +---------------- include/linux/dcache.h | 2 + net/socket.c | 24 +----------------- 5 files changed, 58 insertions(+), 58 deletions(-)