On Mon, 2025-07-28 at 11:36 +0200, Nam Cao wrote: > On Mon, Jul 28, 2025 at 10:59:01AM +0200, Gabriele Monaco wrote: > > Good catch, thanks! The container_of is the way to go. > > Do you have valid reasons not to move the list_head to the top? > > It's > > not a big deal but it would save computing and summing the offset. > > It > > doesn't seem name (the current first element) really needs to stay > > there. > > I checked x86_64 and riscv64, the generated assembly of this function > before & after moving the list_head on top is almost the same except > for > some instructions' intermediate values. Both architectures have > instructions which load data at (pointer + offset), so this offset > computing does not require any extra instruction. > > Best regards, > Nam
Alright then, thanks for checking! Reviewed-by: Gabriele Monaco <[email protected]>
