Skip to content

Commit 42ea22e

Browse files
tecabcrostedt
authored andcommitted
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: [email protected] Fixes: b9b0c83 ("ftrace: Convert graph filter to use hash tables") Link: https://lore.kernel.org/[email protected] Signed-off-by: zhoumin <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 2c9ee74 commit 42ea22e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

kernel/trace/ftrace.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6855,6 +6855,7 @@ ftrace_graph_set_hash(struct ftrace_hash *hash, char *buffer)
68556855
}
68566856
}
68576857
}
6858+
cond_resched();
68586859
} while_for_each_ftrace_rec();
68596860

68606861
return fail ? -EINVAL : 0;

0 commit comments

Comments
 (0)