diff options
author | Mateusz Guzik <mjguzik@gmail.com> | 2025-03-19 22:58:01 +0100 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2025-03-20 09:45:39 +0100 |
commit | 5370b43e4bcf60049bfd44db83ba8d2ec43d0152 (patch) | |
tree | 0d5bfa2b45c0ec532de8f3f2fd3b66c09c850f2d /tools/testing/selftests/bpf/prog_tests/autoload.c | |
parent | dba2e3b788f5ac70ebf717523433e1ceae3f0834 (diff) | |
download | lwn-5370b43e4bcf60049bfd44db83ba8d2ec43d0152.tar.gz lwn-5370b43e4bcf60049bfd44db83ba8d2ec43d0152.zip |
fs: reduce work in fdget_pos()
1. predict the file was found
2. explicitly compare the ref to "one", ignoring the dead zone
The latter arguably improves the behavior to begin with. Suppose the
count turned bad -- the previously used ref routine is going to check
for it and return 0, indicating the count does not necessitate taking
->f_pos_lock. But there very well may be several users.
i.e. not paying for special-casing the dead zone improves semantics.
While here spell out each condition in a dedicated if statement. This
has no effect on generated code.
Sizes are as follows (in bytes; gcc 13, x86-64):
stock: 321
likely(): 298
likely()+ref: 280
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Link: https://lore.kernel.org/r/20250319215801.1870660-1-mjguzik@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/autoload.c')
0 files changed, 0 insertions, 0 deletions