Re: [RFC v2 2/3] atomic: Specify alignment for atomic_t and atomic64_t

From: Arnd Bergmann

Date: Mon Sep 15 2025 - 05:29:35 EST


On Mon, Sep 15, 2025, at 11:26, Finn Thain wrote:
> On Mon, 15 Sep 2025, Arnd Bergmann wrote:
>> Why is this not aligned to 8 bytes? I checked all supported
>> architectures and found that arc, csky, m68k, microblaze, openrisc, sh
>> and x86-32 use a smaller alignment by default, but arc and x86-32
>> override it to 8 bytes already. x86 changed it back in 2009 with commit
>> bbf2a330d92c ("x86: atomic64: The atomic64_t data type should be 8 bytes
>> aligned on 32-bit too"), and arc uses the same one.
>>
>
> Right, I forgot to check includes in arch/x86/include. (I had assumed this
> definition was relevant to that architecture, hence the sizeof(long), in
> order to stick to native alignment on x86-32.)

Ok

>> Changing csky, m68k, microblaze, openrisc and sh to use the same
>> alignment as all others is probably less risky in the long run in case
>> anything relies on that the same way that code expects native alignment
>> on atomic_t.
>>
>
> By "native alignment", do you mean "natural alignment" here?

Yes, that's what I meant.

Arnd