diff options
| author | zhoumin <teczm@foxmail.com> | 2025-04-01 01:00:34 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-05-02 07:39:17 +0200 |
| commit | e5b4ae6f01d4a510d5725eca7254519a1093920d (patch) | |
| tree | 197a3dee4a0667e5d70b0683a6e20b70ea481c89 /kernel | |
| parent | 5a349c098f0573a3f3a63c2fe824f69dd92e8055 (diff) | |
| download | linux-e5b4ae6f01d4a510d5725eca7254519a1093920d.tar.gz linux-e5b4ae6f01d4a510d5725eca7254519a1093920d.tar.bz2 linux-e5b4ae6f01d4a510d5725eca7254519a1093920d.zip | |
ftrace: Add cond_resched() to ftrace_graph_set_hash()
commit 42ea22e754ba4f2b86f8760ca27f6f71da2d982c upstream.
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 <teczm@foxmail.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/trace/ftrace.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index fd393ae98706..50c266f70b54 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -5506,6 +5506,7 @@ ftrace_graph_set_hash(struct ftrace_hash *hash, char *buffer) } } } + cond_resched(); } while_for_each_ftrace_rec(); out: mutex_unlock(&ftrace_lock); |
