[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z9f6Zi2_eZFFY0Q7@google.com>
Date: Mon, 17 Mar 2025 10:33:10 +0000
From: Alice Ryhl <aliceryhl@...gle.com>
To: Kunwu Chan <kunwu.chan@...ux.dev>
Cc: ojeda@...nel.org, alex.gaynor@...il.com, boqun.feng@...il.com,
gary@...yguo.net, bjorn3_gh@...tonmail.com, benno.lossin@...ton.me,
a.hindborg@...nel.org, tmgross@...ch.edu, dakr@...nel.org, nathan@...nel.org,
nick.desaulniers+lkml@...il.com, morbo@...gle.com, justinstitt@...gle.com,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev, Kunwu Chan <kunwu.chan@...mail.com>,
Grace Deng <Grace.Deng006@...il.com>
Subject: Re: [PATCH] rust: page:: optimize rust symbol generation for Page
On Mon, Mar 17, 2025 at 05:40:04PM +0800, Kunwu Chan wrote:
> From: Kunwu Chan <kunwu.chan@...mail.com>
>
> 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'.*Page | rustfilt
> ffff8000805b6f98 T <kernel::page::Page>::alloc_page
> ffff8000805b715c T <kernel::page::Page>::fill_zero_raw
> ffff8000805b720c T <kernel::page::Page>::copy_from_user_slice_raw
> ffff8000805b6fb4 T <kernel::page::Page>::read_raw
> ffff8000805b7088 T <kernel::page::Page>::write_raw
> ffff8000805b72fc T <kernel::page::Page as core::ops::drop::Drop>::drop
>
> These Rust symbols are trivial wrappers around the C functions
> alloc_pages, kunmap_local and __free_pages.
> It doesn't make sense to go through a trivial wrapper for these
> functions, so mark them inline.
>
> Link: https://github.com/Rust-for-Linux/linux/issues/1145
> Suggested-by: Alice Ryhl <aliceryhl@...gle.com>
> Co-developed-by: Grace Deng <Grace.Deng006@...il.com>
> Signed-off-by: Grace Deng <Grace.Deng006@...il.com>
> Signed-off-by: Kunwu Chan <kunwu.chan@...mail.com>
For sure `alloc_page` and `drop` should be inline, but the other methods
are not as simple. It is less clear that they should be inline.
At the very least, the claim that they are a trivial wrapper around
"kunmap_local" is false. They don't just call that method.
Alice
Powered by blists - more mailing lists