linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ftrace: simplify ftrace hash lookup code
@ 2019-09-09  0:31 Changbin Du
  2019-09-09 14:54 ` Steven Rostedt
  0 siblings, 1 reply; 6+ messages in thread
From: Changbin Du @ 2019-09-09  0:31 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Ingo Molnar, linux-kernel, Changbin Du

Function ftrace_lookup_ip() will check empty hash table. So we don't
need extra check outside.

Signed-off-by: Changbin Du <changbin.du@gmail.com>

---
v2: fix incorrect code remove.
---
 kernel/trace/ftrace.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index f9821a3374e9..92aab854d3b1 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1463,8 +1463,7 @@ static bool hash_contains_ip(unsigned long ip,
 	 */
 	return (ftrace_hash_empty(hash->filter_hash) ||
 		__ftrace_lookup_ip(hash->filter_hash, ip)) &&
-		(ftrace_hash_empty(hash->notrace_hash) ||
-		 !__ftrace_lookup_ip(hash->notrace_hash, ip));
+	       !ftrace_lookup_ip(hash->notrace_hash, ip);
 }
 
 /*
@@ -6036,11 +6035,7 @@ clear_func_from_hash(struct ftrace_init_func *func, struct ftrace_hash *hash)
 {
 	struct ftrace_func_entry *entry;
 
-	if (ftrace_hash_empty(hash))
-		return;
-
-	entry = __ftrace_lookup_ip(hash, func->ip);
-
+	entry = ftrace_lookup_ip(hash, func->ip);
 	/*
 	 * Do not allow this rec to match again.
 	 * Yeah, it may waste some memory, but will be removed
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-09-10 14:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-09  0:31 [PATCH v2] ftrace: simplify ftrace hash lookup code Changbin Du
2019-09-09 14:54 ` Steven Rostedt
2019-09-09 23:39   ` Changbin Du
2019-09-10  0:33   ` Changbin Du
2019-09-10  9:28     ` Steven Rostedt
2019-09-10 14:29       ` Changbin Du

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).