Re: [PATCH v2] smp: align struct __call_single_node to 8 bytes
From: David Laight
Date: Wed Sep 23 2026 - 18:10:36 EST
On Wed, 23 Sep 2026 08:43:07 -0700
Brian Cain <brian.cain@xxxxxxxxxxxxxxxx> wrote:
> Consumers walking call_single_queue cast each node to call_single_data_t
> and, given that type's declared over-alignment, the compiler may load
> llist.next and u_flags as one naturally aligned double word. Fields using
> this type, such as task_struct::wake_entry only guarantee pointer alignment,
> which faults on strict-alignment 32-bit architectures like hexagon.
I think the same could happen on arm64.
The compiler is being told the alignment is 4*sizeof(long)), but I doubt it
can ever matter that it is more than 2*sizeof(long).
The other option is to only ever use call_single_data_t to get an aligned
version of the structure and use the struct everywhere else.
The compiler won't be able to use the 'load two register' instruction, but
I doubt that will be measurable.
David
>
> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Paul E. McKenney <paulmck@xxxxxxxxxx>
> Cc: Frederic Weisbecker <frederic@xxxxxxxxxx>
> Cc: linux-hexagon@xxxxxxxxxxxxxxx
> Reviewed-by: Philippe Mathieu-Daudé <philmd@xxxxxxxxxxxxxxxx>
> Signed-off-by: Brian Cain <brian.cain@xxxxxxxxxxxxxxxx>
> ---
> include/linux/smp_types.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/smp_types.h b/include/linux/smp_types.h
> index 2e8461af8df6..5773e1fb2660 100644
> --- a/include/linux/smp_types.h
> +++ b/include/linux/smp_types.h
> @@ -64,6 +64,6 @@ struct __call_single_node {
> #ifdef CONFIG_64BIT
> u16 src, dst;
> #endif
> -};
> +} __aligned(8);
>
> #endif /* __LINUX_SMP_TYPES_H */