fs: cache optimise dentry and inode for rcu-walk
authorNick Piggin <npiggin@kernel.dk>
Fri, 7 Jan 2011 06:49:56 +0000 (17:49 +1100)
committerNick Piggin <npiggin@kernel.dk>
Fri, 7 Jan 2011 06:50:28 +0000 (17:50 +1100)
commit44a7d7a878c9cbb74f236ea755b25b6b2e26a9a9
treed4630a38c0d683a7e1b8823d7971753719b8a54d
parentfb045adb99d9b7c562dc7fef834857f78249daa1
fs: cache optimise dentry and inode for rcu-walk

Put dentry and inode fields into top of data structure.  This allows RCU path
traversal to perform an RCU dentry lookup in a path walk by touching only the
first 56 bytes of the dentry.

We also fit in 8 bytes of inline name in the first 64 bytes, so for short
names, only 64 bytes needs to be touched to perform the lookup. We should
get rid of the hash->prev pointer from the first 64 bytes, and fit 16 bytes
of name in there, which will take care of 81% rather than 32% of the kernel
tree.

inode is also rearranged so that RCU lookup will only touch a single cacheline
in the inode, plus one in the i_ops structure.

This is important for directory component lookups in RCU path walking. In the
kernel source, directory names average is around 6 chars, so this works.

When we reach the last element of the lookup, we need to lock it and take its
refcount which requires another cacheline access.

Align dentry and inode operations structs, so members will be at predictable
offsets and we can group common operations into head of structure.

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
fs/dcache.c
include/linux/dcache.h
include/linux/fs.h