• Mateusz Guzik's avatar
    file: mostly eliminate spurious relocking in __range_close · ed192c59
    Mateusz Guzik authored
    Stock code takes a lock trip for every fd in range, but this can be
    trivially avoided and real-world consumers do have plenty of already
    closed cases.
    
    Just booting Debian 12 with a debug printk shows:
    (sh) min 3 max 17 closed 15 empty 0
    (sh) min 19 max 63 closed 31 empty 14
    (sh) min 4 max 63 closed 0 empty 60
    (spawn) min 3 max 63 closed 13 empty 48
    (spawn) min 3 max 63 closed 13 empty 48
    (mount) min 3 max 17 closed 15 empty 0
    (mount) min 19 max 63 closed 32 empty 13
    
    and so on.
    
    While here use more idiomatic naming.
    
    An avoidable relock is left in place to avoid uglifying the code.
    The code was not switched to bitmap traversal for the same reason.
    
    Tested with ltp kernel/syscalls/close_range
    Signed-off-by: default avatarMateusz Guzik <mjguzik@gmail.com>
    Message-Id: <20230727113809.800067-1-mjguzik@gmail.com>
    Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
    ed192c59
file.c 32.1 KB