Skip to content

Commit

Permalink
ftrace: Avoid synchronize_rcu_tasks_rude() call when not necessary
Browse files Browse the repository at this point in the history
synchronize_rcu_tasks_rude() triggers IPIs and forces rescheduling on
all CPUs. It is a costly operation and, when targeting nohz_full CPUs,
very disrupting (hence the name). So avoid calling it when 'old_hash'
doesn't need to be freed.

Link: https://lkml.kernel.org/r/20210721114726.1545103-1-nsaenzju@redhat.com

Signed-off-by: Nicolas Saenz Julienne <nsaenzju@redhat.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
  • Loading branch information
Nicolas Saenz Julienne authored and Steven Rostedt (VMware) committed Jul 23, 2021
1 parent 9528c19 commit 68e8349
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -5985,7 +5985,8 @@ ftrace_graph_release(struct inode *inode, struct file *file)
* infrastructure to do the synchronization, thus we must do it
* ourselves.
*/
synchronize_rcu_tasks_rude();
if (old_hash != EMPTY_HASH)
synchronize_rcu_tasks_rude();

free_ftrace_hash(old_hash);
}
Expand Down

0 comments on commit 68e8349

Please sign in to comment.