]> www.infradead.org Git - users/jedix/linux-maple.git/commit
perf/aux: Allocate non-contiguous AUX pages by default
authorYabin Cui <yabinc@google.com>
Thu, 8 May 2025 23:26:42 +0000 (16:26 -0700)
committerIngo Molnar <mingo@kernel.org>
Thu, 15 May 2025 16:07:19 +0000 (18:07 +0200)
commit18049c8cff9cc89daadc4df6975f7d9069638926
treebcbb6d02cc2696045e86cae9f0543d28e1a010e2
parent881097c0549f3818f5aa31af8ccb49213bd99bed
perf/aux: Allocate non-contiguous AUX pages by default

perf always allocates contiguous AUX pages based on aux_watermark.
However, this contiguous allocation doesn't benefit all PMUs. For
instance, ARM SPE and TRBE operate with virtual pages, and Coresight
ETR allocates a separate buffer. For these PMUs, allocating contiguous
AUX pages unnecessarily exacerbates memory fragmentation. This
fragmentation can prevent their use on long-running devices.

This patch modifies the perf driver to be memory-friendly by default,
by allocating non-contiguous AUX pages. For PMUs requiring contiguous
pages (Intel BTS and some Intel PT), the existing
PERF_PMU_CAP_AUX_NO_SG capability can be used. For PMUs that don't
require but can benefit from contiguous pages (some Intel PT), a new
capability, PERF_PMU_CAP_AUX_PREFER_LARGE, is added to maintain their
existing behavior.

Signed-off-by: Yabin Cui <yabinc@google.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: James Clark <james.clark@linaro.org>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20250508232642.148767-1-yabinc@google.com
arch/x86/events/intel/pt.c
include/linux/perf_event.h
kernel/events/ring_buffer.c