Re: [PATCH v5 2/4] atomic: Specify alignment for atomic_t and atomic64_t

"Arnd Bergmann" <[email protected]>
Newsgroups gmane.linux.kernel.cross-arch,gmane.linux.kernel,gmane.linux.ports.sh.devel
Message-ID <[email protected]>
On Tue, Dec 16, 2025, at 07:31, Finn Thain wrote:
> Some recent commits incorrectly assumed 4-byte alignment of locks.
> That assumption fails on Linux/m68k (and, interestingly, would have
> failed on Linux/cris also). The jump label implementation makes a
> similar alignment assumption.
>
> The expectation that atomic_t and atomic64_t variables will be naturally
> aligned seems reasonable, as indeed they are on 64-bit architectures.
> But atomic64_t isn't naturally aligned on csky, m68k, microblaze, nios2,
> openrisc and sh. Neither atomic_t nor atomic64_t are naturally aligned
> on m68k.
>
> This patch brings a little uniformity by specifying natural alignment
> for atomic types. One benefit is that atomic64_t variables do not get
> split across a page boundary. The cost is that some structs grow which
> leads to cache misses and wasted memory.

Reviewed-by: Arnd Bergmann <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.