• Linus Torvalds's avatar
    vfs: conditionally clear close-on-exec flag · fc90888d
    Linus Torvalds authored
    We clear the close-on-exec flag when opening and closing files, and the
    bit was almost always already clear before.  Avoid dirtying the
    cacheline if the clearning isn't necessary.  That avoids unnecessary
    cacheline dirtying and bouncing in multi-socket environments.
    
    Eric Dumazet has a file descriptor benchmark that goes 4% faster from
    this on his two-socket machine.  It's probably partly superlinear
    improvement due to getting slightly less spinlock contention on the
    file_lock spinlock due to less work in the critical section.
    Tested-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    fc90888d
file.c 23.5 KB