Skip to contentSkip to conversation

bpf: allocate the buffers BPF map to fit highest CPU id

PATCH New Kris Van Hees 1 participant 1 message Dec 11, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf: allocate the buffers BPF map to fit highest CPU id

Even when less than the possible number of CPUs are online, the 'buffers' BPF map should be allocated based on the highest possible CPU id because probe data is written to the bufer that corresponds to a given CPU id, which could be part of non-sequential CPU id configurations.

---
 libdtrace/dt_bpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libdtrace/dt_bpf.c +1 -1
index 0a57b7d2..6568a572 100644
@@ -755,7 +755,7 @@ gmap_create_buffers(dtrace_hdl_t *dtp)
 {
 	return create_gmap(dtp, "buffers", BPF_MAP_TYPE_PERF_EVENT_ARRAY,
 			   sizeof(uint32_t), sizeof(uint32_t),
-			   dtp->dt_conf.num_online_cpus);
+			   dtp->dt_conf.max_cpuid);
 }
 
 /*
Signature · 1 line
2.43.5