You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add missing #[inline] markers to trivial wrappers around C functions #1145
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.
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.
I 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.
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
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:我知道这种情况正在发生的一些情况:
If you submit a patch that makes this kind of change, please make sure to have a good commit message (see the examples above).如果您提交的补丁进行了此类更改,请确保有一个好的提交消息(请参阅上面的示例)。
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.
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.
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.
Activity
panosfol commentedon Mar 5, 2025
Hello! I would like to tackle this issue
ojeda commentedon Mar 5, 2025
Thanks, please go ahead!
Darksonn commentedon Mar 6, 2025
I 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.
panosfol commentedon Mar 6, 2025
Sounds good!
ethancedwards8 commentedon Mar 10, 2025
Giving it a try: https://lkml.org/lkml/2025/3/9/512
rust/kernel/faux: mark Registration methods inline
rust: task: mark Task methods inline
ojeda commentedon 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/
rust/kernel/faux: mark Registration methods inline
ethancedwards8 commentedon Mar 11, 2025
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
antonio-hickey commentedon Mar 11, 2025
Giving a try for methods in uaccess.
https://lore.kernel.org/all/0100019582fc6956-3b420cce-f122-4a26-8fea-94000b22bc90-000000@email.amazonses.com
#1147
KunWuChan commentedon Mar 11, 2025
Thanks for the hint, I'll submit for the unfinished part, allow me to add a Suggested-by tag.
charmitro commentedon Mar 11, 2025
Hi @KunWuChan, please note the following regarding issues labeled as "good-first-issue":
39 remaining items
rust: page: mark Page::nid as inline
rust: page: mark Page::nid as inline
rust: page: mark Page::nid as inline
rust: page: mark Page::nid as inline
rust: page: mark Page::nid as inline
rust: sync: completion: Mark inline complete_all and wait_for_completion
rust: sync: completion: Mark inline complete_all and wait_for_completion
usb: rust: mark Device and Interface methods as inline
rust: pci: Mark Device refcount methods inline
i2c: rust: mark I2cAdapter methods as inline
i2c: rust: mark I2cAdapter methods as inline
rust: sync: rcu: Mark Guard methods as inline
rust: sync: Mark CondVar::notify_*() inline
rust: sync: Mark PollCondVar::drop() inline
rust: task: Mark Task methods inline