Skip to contentSkip to conversation

perf: Increase MAX_NR_CPUS to 4096

PATCH In review Kyle Meyer 2 participants 2 messages Dec 5, 2024 – Dec 6, 2024 perf events

lore
Share & tools
lore

Kyle Meyer

author
#0 lore raw

PATCH v2 1/1 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.

---

v1 -> v2:
* Increase MAX_NR_CPUS in tools/perf/util/bpf_skel/kwork_top.bpf.c, as suggested by Ian Rogers.
* https://lore.kernel.org/all/[email protected]/

 tools/lib/perf/include/internal/cpumap.h | 2 +-
 tools/perf/perf.h                        | 2 +-
 tools/perf/util/bpf_skel/kwork_top.bpf.c | 4 +++-
 3 files changed, 5 insertions(+), 3 deletions(-)
tools/lib/perf/include/internal/cpumap.h +1 -1
index 49649eb51ce4..3cf28522004e 100644
@@ -22,7 +22,7 @@ DECLARE_RC_STRUCT(perf_cpu_map) {
 };
 
 #ifndef MAX_NR_CPUS
-#define MAX_NR_CPUS	2048
+#define MAX_NR_CPUS	4096
 #endif
 
 struct perf_cpu_map *perf_cpu_map__alloc(int nr_cpus);
tools/perf/perf.h +1 -1
index c004dd4e65a3..3cb40965549f 100644
@@ -3,7 +3,7 @@
 #define _PERF_PERF_H
 
 #ifndef MAX_NR_CPUS
-#define MAX_NR_CPUS			2048
+#define MAX_NR_CPUS			4096
 #endif
 
 enum perf_affinity {
tools/perf/util/bpf_skel/kwork_top.bpf.c +3 -1
index 594da91965a2..73e32e063030 100644
@@ -18,7 +18,9 @@ enum kwork_class_type {
 };
 
 #define MAX_ENTRIES     102400
-#define MAX_NR_CPUS     2048
+#ifndef MAX_NR_CPUS
+#define MAX_NR_CPUS     4096
+#endif
 #define PF_KTHREAD      0x00200000
 #define MAX_COMMAND_LEN 16
 
Signature · 1 line
2.35.3
reviewer Reviewed-by on v2 1/1
#1 lore raw
Quoted 8 lines · Kyle Meyer

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.

Thanks,
Ian

Quoted 56 lines

---

v1 -> v2:
* Increase MAX_NR_CPUS in tools/perf/util/bpf_skel/kwork_top.bpf.c, as suggested by Ian Rogers.
* https://lore.kernel.org/all/[email protected]/

 tools/lib/perf/include/internal/cpumap.h | 2 +-
 tools/perf/perf.h                        | 2 +-
 tools/perf/util/bpf_skel/kwork_top.bpf.c | 4 +++-
 3 files changed, 5 insertions(+), 3 deletions(-)
tools/lib/perf/include/internal/cpumap.h +1 -1
index 49649eb51ce4..3cf28522004e 100644
@@ -22,7 +22,7 @@ DECLARE_RC_STRUCT(perf_cpu_map) {
 };
 
 #ifndef MAX_NR_CPUS
-#define MAX_NR_CPUS    2048
+#define MAX_NR_CPUS    4096
 #endif
 
 struct perf_cpu_map *perf_cpu_map__alloc(int nr_cpus);
tools/perf/perf.h +1 -1
index c004dd4e65a3..3cb40965549f 100644
@@ -3,7 +3,7 @@
 #define _PERF_PERF_H
 
 #ifndef MAX_NR_CPUS
-#define MAX_NR_CPUS                    2048
+#define MAX_NR_CPUS                    4096
 #endif
 
 enum perf_affinity {
tools/perf/util/bpf_skel/kwork_top.bpf.c +3 -2
index 594da91965a2..73e32e063030 100644
@@ -18,7 +18,9 @@ enum kwork_class_type {
 };
 
 #define MAX_ENTRIES     102400
-#define MAX_NR_CPUS     2048
+#ifndef MAX_NR_CPUS
+#define MAX_NR_CPUS     4096
+#endif
 #define PF_KTHREAD      0x00200000
 #define MAX_COMMAND_LEN 16
 
--

2.35.3