diff mbox series

ftrace: add cond resched to ftrace_graph_set_hash

Message ID tencent_3E06CE338692017B5809534B9C5C03DA7705@qq.com (mailing list archive)
State Queued
Headers show
Series ftrace: add cond resched to ftrace_graph_set_hash | expand

Commit Message

zhoumin March 31, 2025, 5 p.m. UTC
When the kernel contains a large number of symbos,loop in
ftrace_graph_set_hash function may take a lot of time to
execute.This may trigger softlockup watchdog.

Add cond _resched within loop. This ensures  the kernel
remains responsive even when processing a large number of symbols.

Signed-off-by: zhoumin <teczm@foxmail.com>
---
 kernel/trace/ftrace.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 92015de6203d..1a48aedb5255 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -6855,6 +6855,7 @@  ftrace_graph_set_hash(struct ftrace_hash *hash, char *buffer)
 				}
 			}
 		}
+		cond_resched();
 	} while_for_each_ftrace_rec();
 
 	return fail ? -EINVAL : 0;