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

libperf cpumap: Hide/reduce scope of MAX_NR_CPUS

Avoid redefinition of MAX_NR_CPUS as a global constant, the original
definition is tools/perf/perf.h.

Reviewed-by: Leo Yan <leo.yan@arm.com>
Signed-off-by: Ian Rogers <irogers@google.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: Kyle Meyer <kyle.meyer@hpe.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-4-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
e8399d34 02b5ed8a

+2 -4
+2
tools/lib/perf/cpumap.c
··· 12 12 #include <limits.h> 13 13 #include "internal.h" 14 14 15 + #define MAX_NR_CPUS 4096 16 + 15 17 void perf_cpu_map__set_nr(struct perf_cpu_map *map, int nr_cpus) 16 18 { 17 19 RC_CHK_ACCESS(map)->nr = nr_cpus;
-4
tools/lib/perf/include/internal/cpumap.h
··· 21 21 struct perf_cpu map[]; 22 22 }; 23 23 24 - #ifndef MAX_NR_CPUS 25 - #define MAX_NR_CPUS 4096 26 - #endif 27 - 28 24 struct perf_cpu_map *perf_cpu_map__alloc(int nr_cpus); 29 25 int perf_cpu_map__idx(const struct perf_cpu_map *cpus, struct perf_cpu cpu); 30 26 bool perf_cpu_map__is_subset(const struct perf_cpu_map *a, const struct perf_cpu_map *b);