[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1c9095f5-df5c-2129-df11-877a03a205ab@linux-m68k.org>
Date: Tue, 16 Sep 2025 10:16:12 +1000 (AEST)
From: Finn Thain <fthain@...ux-m68k.org>
To: Arnd Bergmann <arnd@...db.de>
cc: Peter Zijlstra <peterz@...radead.org>, Will Deacon <will@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Boqun Feng <boqun.feng@...il.com>, Jonathan Corbet <corbet@....net>,
Mark Rutland <mark.rutland@....com>, linux-kernel@...r.kernel.org,
Linux-Arch <linux-arch@...r.kernel.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>, linux-m68k@...r.kernel.org
Subject: Re: [RFC v2 3/3] atomic: Add alignment check to instrumented atomic
operations
On Mon, 15 Sep 2025, Arnd Bergmann wrote:
> On Mon, Sep 15, 2025, at 12:37, Finn Thain wrote:
> > On Mon, 15 Sep 2025, Peter Zijlstra wrote:
> >>
> >> > When you do atomic operations on atomic_t or atomic64_t, (sizeof(long)
> >> > - 1) probably doesn't make much sense. But atomic operations get used on
> >> > scalar types (aside from atomic_t and atomic64_t) that don't have natural
> >> > alignment. Please refer to the other thread about this:
> >> > https://lore.kernel.org/all/ed1e0896-fd85-5101-e136-e4a5a37ca5ff@linux-m68k.org/
> >>
> >> Perhaps set ARCH_SLAB_MINALIGN ?
> >>
> >
> > That's not going to help much. The 850 byte offset of task_works into
> > struct task_struct and the 418 byte offset of exit_state in struct
> > task_struct are already misaligned.
>
> Has there been any progress on building m68k kernels with -mint-align?
Not that I know of.
> IIRC there are only a small number of uapi structures that need
> __packed annotations to maintain the existing syscall ABI.
>
Packing uapi structures (and adopting -malign-int) sounds easier than the
alternative, which might be to align certain internal kernel struct
members, on a case-by-case basis, where doing so could be shown to improve
performance on some architecture or other (while keeping -mno-align-int).
Well, it's easy to find all the structs that belong to the uapi, but it's
not easy to find all the internal kernel structs that describe MMIO
registers. For -malign-int, both kinds of structs are a problem.
If better performance is to be had, my guess is that aligning atomic_t
will get 80% of it (just an appeal to the Pareto principle, FWIW...)
Powered by blists - more mailing lists