From: zhoumin Date: Mon, 31 Mar 2025 17:00:34 +0000 (+0800) Subject: ftrace: Add cond_resched() to ftrace_graph_set_hash() X-Git-Tag: v6.15-rc1~41^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=42ea22e754ba4f2b86f8760ca27f6f71da2d982c;p=thirdparty%2Flinux.git ftrace: Add cond_resched() to ftrace_graph_set_hash() When the kernel contains a large number of functions that can be traced, the loop in ftrace_graph_set_hash() may take a lot of time to execute. This may trigger the softlockup watchdog. Add cond_resched() within the loop to allow the kernel to remain responsive even when processing a large number of functions. This matches the cond_resched() that is used in other locations of the code that iterates over all functions that can be traced. Cc: stable@vger.kernel.org Fixes: b9b0c831bed26 ("ftrace: Convert graph filter to use hash tables") Link: https://lore.kernel.org/tencent_3E06CE338692017B5809534B9C5C03DA7705@qq.com Signed-off-by: zhoumin Signed-off-by: Steven Rostedt (Google) --- diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 92015de6203d1..1a48aedb52552 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;