[PATCH kexec-tools v3] util_lib/elf_info: stream lockless printk ring records

Simon Horman horms at kernel.org
Mon Aug 24 08:38:06 PDT 2026


On Tue, Aug 18, 2026 at 10:29:39AM -0400, Serapheim Dimitropoulos wrote:
> From: Serapheim Dimitropoulos <sdimitropoulos at coreweave.com>
> 
> We came across this while testing kdump on an arm64 system with a 64 MiB
> printk text ring and an 850 MiB capture kernel. vmcore-dmesg was run from
> the capture kernel before makedumpfile, but it was killed with SIGKILL
> before it could produce any output.
> 
> The lockless ringbuffer reader copies the complete descriptor, info, and
> text rings before it starts processing records. For the above setup these
> copies raised peak RSS to about 345 MiB. This is a significant part of the
> memory available to the capture kernel, and most of the copied data is only
> visited once.
> 
> Keep the ring file offsets and read each active record directly instead.
> Allocate space for one descriptor, one info record, and one text record.
> Leave the existing ring geometry parsing, types, traversal, and
> record-state handling unchanged.
> 
> The old and new readers produced byte-identical output for committed and
> finalized records, missed and empty records, wrapped text, non-printable
> bytes, descriptor ID wraparound, and a dense 100000-record fixture.
> 
> For the dense fixture with a 64 MiB text ring, peak RSS dropped from
> 345276 KiB to 1276 KiB. Runtime increased from 1.98 to 2.09 seconds due to
> the per-record reads.
> 
> Fixes: 4149df9005f2 ("printk: add support for lockless ringbuffer")
> Signed-off-by: Serapheim Dimitropoulos <sdimitropoulos at coreweave.com>
> ---
> Changes in v3:
> - Keep the patch focused on changing where ring data is read.
> - Remove the new validation and overflow-checking framework, and retain the
>   existing types, ring geometry parsing, arithmetic, traversal, and
>   record-state handling.
> - Use direct pread() calls and the same error handling style as the existing
>   reader.
> - Re-run make distcheck, byte-for-byte small and dense fixture comparisons,
>   peak RSS measurements, and ASan/UBSan tests of the printk-ring path.
> - Link to v2: https://lore.kernel.org/r/20260803-vmcore-dmesg-stream-upstream-v2-1-cb7f7449bc1b@coreweave.com

Thanks, applied.

- util_lib/elf_info: stream lockless printk ring records
  https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=2bcd7801948d




More information about the kexec mailing list