Skip to contentSkip to conversation

tracing: Ensure optimized hashing works

PATCH New Michal Koutný 1 participant 1 message Sep 24, 2025 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tracing: Ensure optimized hashing works

If ever PID_MAX_DEFAULT changes, it must be compatible with tracing hashmaps assumptions.

---
 kernel/trace/trace_sched_switch.c | 2 ++
 1 file changed, 2 insertions(+)

v1 in https://lore.kernel.org/r/[email protected]/
- cohere with code (Steven)

kernel/trace/trace_sched_switch.c +2 -0
index cb49f7279dc80..9ee62364d98d2 100644
@@ -248,6 +248,8 @@ int trace_save_cmdline(struct task_struct *tsk)
 	if (!tsk->pid)
 		return 1;
 
+	BUILD_BUG_ON(!is_power_of_2(PID_MAX_DEFAULT));
+
 	tpid = tsk->pid & (PID_MAX_DEFAULT - 1);
 
 	/*
Signature · 1 line
2.51.0