diff --git a/tools/perf/lib/cpumap.c b/tools/perf/lib/cpumap.c index 2834753576b2..1f0e6f334237 100644 --- a/tools/perf/lib/cpumap.c +++ b/tools/perf/lib/cpumap.c @@ -100,6 +100,9 @@ struct perf_cpu_map *perf_cpu_map__read(FILE *file) if (prev >= 0) { int new_max = nr_cpus + cpu - prev - 1; + WARN_ONCE(new_max >= MAX_NR_CPUS, "Perf can support %d CPUs. " + "Consider raising MAX_NR_CPUS\n", MAX_NR_CPUS); + if (new_max >= max_entries) { max_entries = new_max + MAX_NR_CPUS / 2; tmp = realloc(tmp_cpus, max_entries * sizeof(int)); @@ -192,6 +195,9 @@ struct perf_cpu_map *perf_cpu_map__new(const char *cpu_list) end_cpu = start_cpu; } + WARN_ONCE(end_cpu >= MAX_NR_CPUS, "Perf can support %d CPUs. " + "Consider raising MAX_NR_CPUS\n", MAX_NR_CPUS); + for (; start_cpu <= end_cpu; start_cpu++) { /* check for duplicates */ for (i = 0; i < nr_cpus; i++)