Skip to contentSkip to conversation

ftrace: Use within_module to check rec->ip within specified module.

PATCH New Levi Yun 1 participant 1 message Aug 3, 2023

Subsystems (2)
lore
Share & tools
lore

Levi Yun

author
#0 lore raw

PATCH 1/1 ftrace: Use within_module to check rec->ip within specified module.

within_module_core && within_module_init condition is same to within module but it's more readable.

Use within_module instead of former condition to check rec->ip within specified module area or not.

---
 kernel/trace/ftrace.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
kernel/trace/ftrace.c +2 -4
index 05c0024815bf..c46dd6d97afe 100644
@@ -6779,8 +6779,7 @@ void ftrace_release_mod(struct module *mod)
 	last_pg = &ftrace_pages_start;
 	for (pg = ftrace_pages_start; pg; pg = *last_pg) {
 		rec = &pg->records[0];
-		if (within_module_core(rec->ip, mod) ||
-		    within_module_init(rec->ip, mod)) {
+		if (within_module(rec->ip, mod)) {
 			/*
 			 * As core pages are first, the first
 			 * page should never be a module page.
@@ -6852,8 +6851,7 @@ void ftrace_module_enable(struct module *mod)
 		 * not part of this module, then skip this pg,
 		 * which the "break" will do.
 		 */
-		if (!within_module_core(rec->ip, mod) &&
-		    !within_module_init(rec->ip, mod))
+		if (!within_module(rec->ip, mod))
 			break;
 
 		/* Weak functions should still be ignored */
Signature · 1 line
2.37.2