Skip to contentSkip to conversation

rust: file: optimize rust symbol generation for FileDescriptorReservation

PATCH Benno Lossin 1 participant 1 message Mar 17, 2025 Rust

lore
Share & tools
lore

Benno Lossin

author Reviewed-by
#0 lore raw
Quoted 15 lines · Kunwu Chan

From: Kunwu Chan <[email protected]>

When build the kernel using the llvm-18.1.3-rust-1.85.0-x86_64 with ARCH=arm64, the following symbols are generated:

$ nm vmlinux | grep ' _R'.*FileDescriptorReservation | rustfilt
... T <kernel::fs::file::FileDescriptorReservation>::fd_install
... T <kernel::fs::file::FileDescriptorReservation>::get_unused_fd_flags
... T <kernel::fs::file::FileDescriptorReservation as core::ops::drop::Drop>::drop

These Rust symbols are trivial wrappers around the C functions fd_install, put_unused_fd and put_task_struct. It doesn't make sense to go through a trivial wrapper for these functions, so mark them inline.

Quoted 5 lines

---
Cheers,
Benno

Quoted 8 lines

---
Changes in v2:
- Add link and Suggested-by
- Mark 'reserved_fd' as inline
- Reword commit msg

---
 rust/kernel/fs/file.rs | 4 ++++
 1 file changed, 4 insertions(+)