Description
When writing abstractions around core C apis, we often have Rust functions that do nothing other than call a C function. In those cases, we don't want the generated code to have a trivial Rust wrapper around the C function — Rust should inline it and generate a direct call into C.
However, in some cases that requires an #[inline]
marker. Many methods in the kernel is missing it, and so this issue tracks such additions.
A few cases where I know that this is happening:
rust/kernel/task.rs
rust/kernel/page.rs
rust/kernel/sync/condvar.rs
rust/kernel/fs.rs
specificallyFileDescriptorReservation
rust/kernel/seq_file.rs
rust/kernel/uaccess.rs
To find these, you can inspect the Rust symbols yourself by building the kernel and running this command:
nm vmlinux | grep ' _R' | rustfilt
Examples of good patches that make this kind of change:
If you submit a patch that makes this kind of change, please make sure to have a good commit message (see the examples above).
This requires submitting a proper patch to the LKML and the Rust for Linux mailing list. Please recall to test your changes (including generating the documentation if changed, running the Rust doctests if changed, etc.), to use a proper title for the commit, to sign your commit under the Developer's Certificate of Origin and to add a Suggested-by:
tag and a Link:
tag to this issue. Please see https://docs.kernel.org/process/submitting-patches.html and https://rust-for-linux.com/contributing for details.
Please take this issue only if you are new to the kernel development process and you would like to use it as a test to submit your first patch to the kernel. Please do not take it if you do not plan to make other contributions to the kernel.