Skip to content

Commit 50b35c9

Browse files
olsajirirostedt
authored andcommitted
ftrace: Use hash argument for tmp_ops in update_ftrace_direct_mod
The modify logic registers temporary ftrace_ops object (tmp_ops) to trigger the slow path for all direct callers to be able to safely modify attached addresses. At the moment we use ops->func_hash for tmp_ops filter, which represents all the systems attachments. It's faster to use just the passed hash filter, which contains only the modified sites and is always a subset of the ops->func_hash. Cc: Alexei Starovoitov <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: Andrii Nakryiko <[email protected]> Cc: Menglong Dong <[email protected]> Cc: Song Liu <[email protected]> Link: https://patch.msgid.link/[email protected] Fixes: e93672f ("ftrace: Add update_ftrace_direct_mod function") Signed-off-by: Jiri Olsa <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent f35dbac commit 50b35c9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

kernel/trace/ftrace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6606,9 +6606,9 @@ int update_ftrace_direct_mod(struct ftrace_ops *ops, struct ftrace_hash *hash, b
66066606
if (!orig_hash)
66076607
goto unlock;
66086608

6609-
/* Enable the tmp_ops to have the same functions as the direct ops */
6609+
/* Enable the tmp_ops to have the same functions as the hash object. */
66106610
ftrace_ops_init(&tmp_ops);
6611-
tmp_ops.func_hash = ops->func_hash;
6611+
tmp_ops.func_hash->filter_hash = hash;
66126612

66136613
err = register_ftrace_function_nolock(&tmp_ops);
66146614
if (err)

0 commit comments

Comments
 (0)