diff options
-rw-r--r-- | tools/perf/util/session.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 7350b0dfbc1e..13486bcf74a0 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -2292,6 +2292,7 @@ int perf_session__cpu_bitmap(struct perf_session *session, { int i, err = -1; struct perf_cpu_map *map; + int nr_cpus = min(session->header.env.nr_cpus_online, MAX_NR_CPUS); for (i = 0; i < PERF_TYPE_MAX; ++i) { struct evsel *evsel; @@ -2316,7 +2317,7 @@ int perf_session__cpu_bitmap(struct perf_session *session, for (i = 0; i < map->nr; i++) { int cpu = map->map[i]; - if (cpu >= MAX_NR_CPUS) { + if (cpu >= nr_cpus) { pr_err("Requested CPU %d too large. " "Consider raising MAX_NR_CPUS\n", cpu); goto out_delete_map; |