Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf: Increase MAX_NR_CPUS to 4096

Systems have surpassed 2048 CPUs. Increase MAX_NR_CPUS to 4096.

Bitmaps declared with MAX_NR_CPUS bits will increase from 256B to 512B,
cpus_runtime will increase from 81960B to 163880B, and max_entries will
increase from 8192B to 16384B.

Reviewed-by: Ian Rogers <irogers@google.com>
Reviewed-by: Leo Yan <leo.yan@arm.com>
Signed-off-by: Kyle Meyer <kyle.meyer@hpe.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ben Gainey <ben.gainey@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20241206044035.1062032-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Kyle Meyer and committed by
Arnaldo Carvalho de Melo
9a1e1065 9e7a00ec

+5 -3
+1 -1
tools/lib/perf/include/internal/cpumap.h
··· 22 22 }; 23 23 24 24 #ifndef MAX_NR_CPUS 25 - #define MAX_NR_CPUS 2048 25 + #define MAX_NR_CPUS 4096 26 26 #endif 27 27 28 28 struct perf_cpu_map *perf_cpu_map__alloc(int nr_cpus);
+1 -1
tools/perf/perf.h
··· 3 3 #define _PERF_PERF_H 4 4 5 5 #ifndef MAX_NR_CPUS 6 - #define MAX_NR_CPUS 2048 6 + #define MAX_NR_CPUS 4096 7 7 #endif 8 8 9 9 enum perf_affinity {
+3 -1
tools/perf/util/bpf_skel/kwork_top.bpf.c
··· 18 18 }; 19 19 20 20 #define MAX_ENTRIES 102400 21 - #define MAX_NR_CPUS 2048 21 + #ifndef MAX_NR_CPUS 22 + #define MAX_NR_CPUS 4096 23 + #endif 22 24 #define PF_KTHREAD 0x00200000 23 25 #define MAX_COMMAND_LEN 16 24 26