[RFC v4 0/5] Align atomic storage
From: Finn Thain
Date: Mon Oct 20 2025 - 18:35:55 EST
This series adds the __aligned attribute to atomic_t and atomic64_t
definitions in include/asm-generic.
It also adds Kconfig options to enable a new runtime warning to help
reveal misaligned atomic accesses on platforms which don't trap that.
This patch series is a Request For Comments because the alignment
change is a time/space tradeoff. Its costs and benefits are expected
to vary across platforms and workloads. More measurements are needed.
---
Changed since v3:
- Rebased on v6.17.
- New patch to resolve header dependency issue on parisc.
- Dropped documentation patch.
Changed since v2:
- Specify natural alignment for atomic64_t.
- CONFIG_DEBUG_ATOMIC checks for natural alignment again.
- New patch to add weakened alignment check.
- New patch for explicit alignment in BPF header.
---
Finn Thain (4):
bpf: Explicitly align bpf_res_spin_lock
parisc: Drop linux/kernel.h include from asm/bug.h header
atomic: Specify alignment for atomic_t and atomic64_t
atomic: Add option for weaker alignment check
Peter Zijlstra (1):
atomic: Add alignment check to instrumented atomic operations
arch/parisc/include/asm/bug.h | 2 --
include/asm-generic/atomic64.h | 2 +-
include/asm-generic/rqspinlock.h | 2 +-
include/linux/instrumented.h | 15 +++++++++++++++
include/linux/types.h | 2 +-
kernel/bpf/rqspinlock.c | 1 -
lib/Kconfig.debug | 18 ++++++++++++++++++
7 files changed, 36 insertions(+), 6 deletions(-)
--
2.49.1