Linux 7.4 makes RISC-V unaligned memory optimization portable at run-time
RISC-V kernel builds can now detect fast misaligned memory access support at run-time rather than compile-time, enabling distribution kernels to benefit from up to 11% bandwidth improvements without sacrificing hardware compatibility.
Summary
The RISC-V architecture pull request for Linux 7.4 introduces a run-time detection mechanism for fast unaligned memory access, making a performance optimization from Linux 7.3 available to generic distribution kernels. Previously, Tenstorrent's optimization to skip software alignment during user memory copies required compile-time enabling of HAVE_EFFICIENT_UNALIGNED_ACCESS, limiting it to kernels built specifically for hardware known to support fast misaligned accesses. Linux 7.4 moves this check to run-time, allowing a single kernel image to serve both capable and non-capable RISC-V hardware.
Beyond the user copy improvement, the RISC-V changes for 7.4 include crash hot-plug support, optimized page table function paths, context switch optimizations, hwcap and hwprobe reporting for the RISC-V "B" bit-manipulation ISA extension, and reporting support for the Zic64b ISA extension. The merge was completed in the Git repository ahead of the 7.4 release cycle.
Run-time detection and RISC-V 7.4 architecture changes
- User copy optimization: The HAVE_EFFICIENT_UNALIGNED_ACCESS check for skipping software alignment during memory copies is now evaluated at run-time rather than compile-time, enabling generic kernels to use fast unaligned access when present.
- Performance gain: Tenstorrent's prior testing showed up to 11% bandwidth improvement from eliminating software alignment overhead on hardware with native fast misaligned memory copy support.
- Crash hot-plug: Linux 7.4 adds kernel support for crash hot-plug on RISC-V, improving reliability and serviceability for server and embedded deployments.
- Page table and context switch optimizations: The pull request includes optimized code paths for certain page table functions and reduced overhead during context switching.
- ISA extension reporting: The "B" standard extension for bit-manipulation and the Zic64b extension are now exposed through hwcap and hwprobe interfaces for user-space feature detection.
Why it matters
This change removes a significant barrier for Linux distributions shipping unified RISC-V kernel images, as they no longer must choose between performance on modern hardware and compatibility with older or simpler cores that lack fast unaligned access. The improvement strengthens RISC-V's position as a viable target for general-purpose Linux distributions and cloud deployments where a single kernel build must serve heterogeneous hardware.
Original reference: www.phoronix.com →