Thread (2 messages) 2 messages, 2 authors, 2025-09-24
STALE308d

[PATCH] tracing: Ensure optimized hashing works

From: Michal Koutný <mkoutny@suse.com>
Date: 2025-09-23 16:59:20
Also in: lkml
Subsystem: the rest, tracing · Maintainers: Linus Torvalds, Steven Rostedt, Masami Hiramatsu

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

Link: https://lore.kernel.org/r/20240409110126.651e94cb@gandalf.local.home/ (local)
Signed-off-by: Michal Koutný <mkoutny@suse.com>
---
 kernel/trace/trace_sched_switch.c | 2 ++
 1 file changed, 2 insertions(+)

Drive-by flushing an old idea. Take it or leave it.
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c
index cb49f7279dc80..aabae7daaac91 100644
--- a/kernel/trace/trace_sched_switch.c
+++ b/kernel/trace/trace_sched_switch.c
@@ -243,6 +243,8 @@ int trace_create_savedcmd(void)
 int trace_save_cmdline(struct task_struct *tsk)
 {
 	unsigned tpid, idx;
+	/* so that map_pid_to_cmdline indexing is efficient */
+	BUILD_BUG_ON(!is_power_of_2(PID_MAX_DEFAULT));
 
 	/* treat recording of idle task as a success */
 	if (!tsk->pid)
-- 
2.51.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help