Re: [PATCH v5 04/17] rust: task: remove use of `addr_of!` macro
From: Benno Lossin
Date: Sun Mar 23 2025 - 06:32:50 EST
On Thu Mar 20, 2025 at 3:07 AM CET, Antonio Hickey wrote:
> The use of `addr_of!` here is unnecessary since its immediately
> dereferenced. The main benefit of `addr_of!` is to avoid intermediate
> field loads without immediate dereferencing, so there's no benefit in
> using it here.
>
> We can achieve the same behavior by directly accessing the
> `group_leader` and `pid` fields, which is more idiomatic.
>
> Suggested-by: Benno Lossin <benno.lossin@xxxxxxxxx>
> Link: https://github.com/Rust-for-Linux/linux/issues/1148
> Signed-off-by: Antonio Hickey <contact@xxxxxxxxxxxxxxxxx>
Reviewed-by: Benno Lossin <benno.lossin@xxxxxxxxx>
---
Cheers,
Benno
> ---
> rust/kernel/task.rs | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)