<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/rust/kernel/sync/rcu.rs, branch v6.18.21</title>
<subtitle>Clone of https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git</subtitle>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/'/>
<entry>
<title>rust: sync: rcu: Mark Guard methods as inline</title>
<updated>2025-05-16T13:00:54+00:00</updated>
<author>
<name>I Hsin Cheng</name>
<email>richard120310@gmail.com</email>
</author>
<published>2025-03-19T02:26:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=9520371e3daa75cd508b262ac16a732d3ffc9a30'/>
<id>9520371e3daa75cd508b262ac16a732d3ffc9a30</id>
<content type='text'>
Currently the implementation of "Guard" methods are basically wrappers
around rcu's function within kernel. Building the kernel with llvm
18.1.8 on x86_64 machine will generate the following symbols:

$ nm vmlinux | grep ' _R'.*Guard | rustfilt
ffffffff817b6c90 T &lt;kernel::sync::rcu::Guard&gt;::new
ffffffff817b6cb0 T &lt;kernel::sync::rcu::Guard&gt;::unlock
ffffffff817b6cd0 T &lt;kernel::sync::rcu::Guard as core::ops::drop::Drop&gt;::drop
ffffffff817b6c90 T &lt;kernel::sync::rcu::Guard as core::default::Default&gt;::default

These Rust symbols are basically wrappers around functions
"rcu_read_lock" and "rcu_read_unlock". Marking them as inline can
reduce the generation of these symbols, and saves the size of code
generation for 132 bytes.

$ ./scripts/bloat-o-meter vmlinux_old vmlinux_new
(Output is demangled for readability)

add/remove: 0/10 grow/shrink: 0/1 up/down: 0/-132 (-132)
Function                                     old     new   delta
rust_driver_pci::SampleDriver::probe        1041    1034      -7
kernel::sync::rcu::Guard::default             9       -      -9
kernel::sync::rcu::Guard::drop                9       -      -9
kernel::sync::rcu::read_lock                  9       -      -9
kernel::sync::rcu::Guard::unlock              9       -      -9
kernel::sync::rcu::Guard::new                 9       -      -9
__pfx__kernel::sync::rcu::Guard::default     16       -     -16
__pfx__kernel::sync::rcu::Guard::drop        16       -     -16
__pfx__kernel::sync::rcu::read_lock          16       -     -16
__pfx__kernel::sync::rcu::Guard::unlock      16       -     -16
__pfx__kernel::sync::rcu::Guard::new         16       -     -16
Total: Before=23365955, After=23365823, chg -0.00%

Link: https://github.com/Rust-for-Linux/linux/issues/1145
Signed-off-by: I Hsin Cheng &lt;richard120310@gmail.com&gt;
Reviewed-by: Joel Fernandes &lt;joelagnelf@nvidia.com&gt;
Reviewed-by: Benno Lossin &lt;benno.lossin@proton.me&gt;
Reviewed-by: Charalampos Mitrodimas &lt;charmitro@posteo.net&gt;
Acked-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
Signed-off-by: Joel Fernandes &lt;joelagnelf@nvidia.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently the implementation of "Guard" methods are basically wrappers
around rcu's function within kernel. Building the kernel with llvm
18.1.8 on x86_64 machine will generate the following symbols:

$ nm vmlinux | grep ' _R'.*Guard | rustfilt
ffffffff817b6c90 T &lt;kernel::sync::rcu::Guard&gt;::new
ffffffff817b6cb0 T &lt;kernel::sync::rcu::Guard&gt;::unlock
ffffffff817b6cd0 T &lt;kernel::sync::rcu::Guard as core::ops::drop::Drop&gt;::drop
ffffffff817b6c90 T &lt;kernel::sync::rcu::Guard as core::default::Default&gt;::default

These Rust symbols are basically wrappers around functions
"rcu_read_lock" and "rcu_read_unlock". Marking them as inline can
reduce the generation of these symbols, and saves the size of code
generation for 132 bytes.

$ ./scripts/bloat-o-meter vmlinux_old vmlinux_new
(Output is demangled for readability)

add/remove: 0/10 grow/shrink: 0/1 up/down: 0/-132 (-132)
Function                                     old     new   delta
rust_driver_pci::SampleDriver::probe        1041    1034      -7
kernel::sync::rcu::Guard::default             9       -      -9
kernel::sync::rcu::Guard::drop                9       -      -9
kernel::sync::rcu::read_lock                  9       -      -9
kernel::sync::rcu::Guard::unlock              9       -      -9
kernel::sync::rcu::Guard::new                 9       -      -9
__pfx__kernel::sync::rcu::Guard::default     16       -     -16
__pfx__kernel::sync::rcu::Guard::drop        16       -     -16
__pfx__kernel::sync::rcu::read_lock          16       -     -16
__pfx__kernel::sync::rcu::Guard::unlock      16       -     -16
__pfx__kernel::sync::rcu::Guard::new         16       -     -16
Total: Before=23365955, After=23365823, chg -0.00%

Link: https://github.com/Rust-for-Linux/linux/issues/1145
Signed-off-by: I Hsin Cheng &lt;richard120310@gmail.com&gt;
Reviewed-by: Joel Fernandes &lt;joelagnelf@nvidia.com&gt;
Reviewed-by: Benno Lossin &lt;benno.lossin@proton.me&gt;
Reviewed-by: Charalampos Mitrodimas &lt;charmitro@posteo.net&gt;
Acked-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
Signed-off-by: Joel Fernandes &lt;joelagnelf@nvidia.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: add rcu abstraction</title>
<updated>2024-12-20T16:19:26+00:00</updated>
<author>
<name>Wedson Almeida Filho</name>
<email>wedsonaf@gmail.com</email>
</author>
<published>2024-12-19T17:04:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=51158207294108898e5b72bb78fa51a7e848844f'/>
<id>51158207294108898e5b72bb78fa51a7e848844f</id>
<content type='text'>
Add a simple abstraction to guard critical code sections with an rcu
read lock.

Reviewed-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Wedson Almeida Filho &lt;wedsonaf@gmail.com&gt;
Co-developed-by: Danilo Krummrich &lt;dakr@kernel.org&gt;
Signed-off-by: Danilo Krummrich &lt;dakr@kernel.org&gt;
Tested-by: Dirk Behme &lt;dirk.behme@de.bosch.com&gt;
Tested-by: Fabien Parent &lt;fabien.parent@linaro.org&gt;
Link: https://lore.kernel.org/r/20241219170425.12036-5-dakr@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a simple abstraction to guard critical code sections with an rcu
read lock.

Reviewed-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Wedson Almeida Filho &lt;wedsonaf@gmail.com&gt;
Co-developed-by: Danilo Krummrich &lt;dakr@kernel.org&gt;
Signed-off-by: Danilo Krummrich &lt;dakr@kernel.org&gt;
Tested-by: Dirk Behme &lt;dirk.behme@de.bosch.com&gt;
Tested-by: Fabien Parent &lt;fabien.parent@linaro.org&gt;
Link: https://lore.kernel.org/r/20241219170425.12036-5-dakr@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
