• Linus Torvalds's avatar
    vfs: avoid non-forwarding large load after small store in path lookup · 9226b5b4
    Linus Torvalds authored
    The performance regression that Josef Bacik reported in the pathname
    lookup (see commit 99d263d4 "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: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    9226b5b4
namei.c 111 KB