]> git.baikalelectronics.ru Git - kernel.git/commit
vfs: avoid non-forwarding large load after small store in path lookup
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 15 Sep 2014 00:28:32 +0000 (17:28 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 15 Sep 2014 00:28:32 +0000 (17:28 -0700)
commit65a6db0da57a5ea153b8aca9834184f420157e96
tree2b9ff475c498e19606031d5e7fde74cdba30dee8
parente0c0ca17cc6a9c45002bb1fcbf75f1db82d65df8
vfs: avoid non-forwarding large load after small store in path lookup

The performance regression that Josef Bacik reported in the pathname
lookup (see commit 4647826d489f "vfs: fix bad hashing of dentries") made
me look at performance stability of the dcache code, just to verify that
the problem was actually fixed.  That turned up a few other problems in
this area.

There are a few cases where we exit RCU lookup mode and go to the slow
serializing case when we shouldn't, Al has fixed those and they'll come
in with the next VFS pull.

But my performance verification also shows that link_path_walk() turns
out to have a very unfortunate 32-bit store of the length and hash of
the name we look up, followed by a 64-bit read of the combined hash_len
field.  That screws up the processor store to load forwarding, causing
an unnecessary hickup in this critical routine.

It's caused by the ugly calling convention for the "hash_name()"
function, and easily fixed by just making hash_name() fill in the whole
'struct qstr' rather than passing it a pointer to just the hash value.

With that, the profile for this function looks much smoother.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/namei.c
include/linux/dcache.h