]> www.infradead.org Git - users/willy/pagecache.git/commitdiff
ftrace: Do not add duplicate entries in subops manager ops
authorSteven Rostedt <rostedt@goodmis.org>
Thu, 20 Feb 2025 20:20:11 +0000 (15:20 -0500)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Fri, 21 Feb 2025 14:36:12 +0000 (09:36 -0500)
Check if a function is already in the manager ops of a subops. A manager
ops contains multiple subops, and if two or more subops are tracing the
same function, the manager ops only needs a single entry in its hash.

Cc: stable@vger.kernel.org
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Link: https://lore.kernel.org/20250220202055.226762894@goodmis.org
Fixes: 4f554e955614f ("ftrace: Add ftrace_set_filter_ips function")
Tested-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/ftrace.c

index bec54dc272049066dcca84eefb508e7f2efbc937..6b0c25761ccb1e5ef002f0f388019310d7de2655 100644 (file)
@@ -5718,6 +5718,9 @@ __ftrace_match_addr(struct ftrace_hash *hash, unsigned long ip, int remove)
                        return -ENOENT;
                free_hash_entry(hash, entry);
                return 0;
+       } else if (__ftrace_lookup_ip(hash, ip) != NULL) {
+               /* Already exists */
+               return 0;
        }
 
        entry = add_hash_entry(hash, ip);