Repository navigation
Add missing #[inline] markers to trivial wrappers around C functions #1145
Description
Activity
- addedeasyExpected to be an easy issue to resolve.Expected to be an easy issue to resolve.good first issueGood for newcomersGood for newcomers
on Mar 5, 2025 Hello! I would like to tackle this issue
Thanks, please go ahead!
Reacted by Panagiotis FoliadisI recommend that you don't try to tackle every single method in one go. Start with one or two files and send a patch just for those, like the example patches did.
Reacted by Panagiotis FoliadisSounds good!
Giving it a try: https://lkml.org/lkml/2025/3/9/512
- added 2 commits that reference this issue
on Mar 10, 2025 Thanks both for the patches!
By the way, please prefer lore.kernel.org for links, e.g. @ethancedwards8's patch is: https://lore.kernel.org/rust-for-linux/20250309-faux-inline-v1-1-c1b692862433@ethancedwards.com/
- added a commit that references this issue
on Mar 10, 2025 Thanks both for the patches!
By the way, please prefer lore.kernel.org for links, e.g. @ethancedwards8's patch is: https://lore.kernel.org/rust-for-linux/20250309-faux-inline-v1-1-c1b692862433@ethancedwards.com/
Yeah, I typically use lore.kernel.org, but last night when I was sending the patch lore.kernel.org was having some issues (I was getting 504 errors), so I used lkml.org instead. I will use lore.kernel.org exclusively in the future, however
Giving a try for methods in uaccess.
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.在围绕核心 C API 编写抽象时,我们经常会有 Rust 函数,它们除了调用 C 函数之外什么都不做。在这些情况下,我们不希望生成的代码在 C 函数周围有一个简单的 Rust 包装器——Rust 应该内联它并生成对 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.但是,在某些情况下,这需要#[inline]标记。内核中的许多方法都缺少它,因此 issue 跟踪此类添加。A few cases where I know that this is happening:我知道这种情况正在发生的一些情况:
rust/kernel/task.rs``rust/内核/task.rsrust/kernel/page.rsrust/kernel/sync/condvar.rsrust/kernel/fs.rsspecificallyFileDescriptorReservation``rust/kernel/fs.rs,特别是FileDescriptorReservationrust/kernel/seq_file.rs``rust/内核/seq_file.rsrust/kernel/uaccess.rs``rust/内核/uaccess.rs
To find these, you can inspect the Rust symbols yourself by building the kernel and running this command:要找到这些,您可以通过构建内核并运行以下命令来自己检查 Rust 符号:
nm vmlinux | grep ' _R' | rustfiltExamples of good patches that make this kind of change:进行此类更改的良好补丁示例:
- Example that fixes
rust/kernel/cred.rs修复rust/kernel/cred.rs的示例 - Example that fixes
rust/kernel/security.rs修复rust/kernel/security.rs的示例
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: tagand aLink:tag to this issue. Please see https://docs.kernel.org/process/submitting-patches.html and https://rust-for-linux.com/contributing for details.这需要向 LKML 和 Rust for Linux 邮件列表提交适当的补丁。请回想测试您的更改(包括更改后生成文档,如果更改则运行 Rust 文档测试等),为提交使用适当的标题,在开发者的原产地证书下签署您的提交,并为此问题添加Suggested-by: 标签和Link:标签。有关详细信息,请参阅 https://docs.kernel.org/process/submitting-patches.html 和 https://rust-for-linux.com/contributing。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.仅当您不熟悉内核开发过程,并且希望将其用作测试以向内核提交您的第一个补丁时,才请关注此问题。如果您不打算对内核做出其他贡献,请不要接受它。
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.rsrust/kernel/page.rsrust/kernel/sync/condvar.rsrust/kernel/fs.rsspecificallyFileDescriptorReservationrust/kernel/seq_file.rsrust/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' | rustfiltExamples 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: tagand aLink: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.
Thanks for the hint, I'll submit for the unfinished part, allow me to add a Suggested-by tag.
Thanks for the hint, I'll submit for the unfinished part, allow me to add a Suggested-by tag.
Hi @KunWuChan, please note the following regarding issues labeled as "good-first-issue":
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.
39 remaining items
- added a commit that references this issue
on Jun 9, 2026 - added a commit that references this issue
on Jun 15, 2026 - added a commit that references this issue
on Jul 20, 2026 - added 2 commits that reference this issue
on Aug 7, 2026 - added a commit that references this issue
on Aug 24, 2026
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.rsrust/kernel/page.rsrust/kernel/sync/condvar.rsrust/kernel/fs.rsspecificallyFileDescriptorReservationrust/kernel/seq_file.rsrust/kernel/uaccess.rsTo find these, you can inspect the Rust symbols yourself by building the kernel and running this command:
Examples of good patches that make this kind of change:
rust/kernel/cred.rsrust/kernel/security.rsIf 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 aLink: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.