Skip to content

Commit 2378a19

Browse files
Werkovrostedt
authored andcommitted
tracing: Ensure optimized hashing works
If ever PID_MAX_DEFAULT changes, it must be compatible with tracing hashmaps assumptions. Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Link: https://lore.kernel.org/20250924113810.2433478-1-mkoutny@suse.com Link: https://lore.kernel.org/r/20240409110126.651e94cb@gandalf.local.home/ Signed-off-by: Michal Koutný <mkoutny@suse.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent 4099b98 commit 2378a19

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/trace/trace_sched_switch.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ int trace_save_cmdline(struct task_struct *tsk)
247247
if (!tsk->pid)
248248
return 1;
249249

250+
BUILD_BUG_ON(!is_power_of_2(PID_MAX_DEFAULT));
251+
250252
tpid = tsk->pid & (PID_MAX_DEFAULT - 1);
251253

252254
/*

0 commit comments

Comments
 (0)