tracepoint: Do not waste memory on mods with no tracepoints
Steven Rostedt
maintainerRFC PATCH 1/1 tracepoint: Do not waste memory on mods with no tracepoints
No reason to allocate tp_module structures for modules that have no tracepoints. This just wastes memory.
--- kernel/tracepoint.c | 6 ++++++ 1 file changed, 6 insertions(+)
kernel/tracepoint.c +6 -0
@@ -636,6 +636,9 @@ static int tracepoint_module_coming(struct module *mod)struct tp_module *tp_mod, *iter;int ret =0 ; +if (!mod->num_tracepoints) +return 0 ; +/* * We skip modules that taint the kernel, especially those with different * module headers (for forced load), to make sure we don't cause a crash.
@@ -679,6 +682,9 @@ static int tracepoint_module_going(struct module *mod) {struct tp_module *pos; +if (!mod->num_tracepoints) +return 0 ; +mutex_lock (&tracepoints_mutex);tracepoint_update_probe_range (mod->tracepoints_ptrs, mod->tracepoints_ptrs + mod->num_tracepoints);
Signature · 1 line
1.8.1.4
----- Original Message -----
Quoted 11 lines
From: "Steven Rostedt" <[email protected]>
To: "LKML" <[email protected]>
Cc: "Ingo Molnar" <[email protected]>, "Rusty Russell" <[email protected]>, "Peter Zijlstra" <[email protected]>, "Mathieu Desnoyers" <[email protected]>, "Andrew Morton" <[email protected]>
Sent: Wednesday, February 26, 2014 11:03:13 AM
Subject: [RFC][PATCH] tracepoint: Do not waste memory on mods with no tracepointsNo reason to allocate
tp_modulestructures for modules that have no tracepoints. This just wastes memory.
Good catch! Thanks!
Quoted 37 lines
Fixes b75ef8b44b1c "Tracepoint: Dissociate from module mutex"Cc [email protected] # 3.2+Cc Mathieu Desnoyers <[email protected]>Signed-off-by Steven Rostedt <[email protected]>--- kernel/tracepoint.c | 6 ++++++ 1 file changed, 6 insertions(+)kernel/tracepoint.c +6
-1@@ -636,6 +636,9 @@ static int tracepoint_module_coming(struct module *mod)struct tp_module *tp_mod, *iter;int ret =0 ; +if (!mod->num_tracepoints) +return 0 ; +/* * We skip modules that taint the kernel, especially those with different * module headers (for forced load), to make sure we don't cause a crash. @@ -679,6 +682,9 @@ static int tracepoint_module_going(struct module *mod) {struct tp_module *pos; +if (!mod->num_tracepoints) +return 0 ; +mutex_lock (&tracepoints_mutex);tracepoint_update_probe_range (mod->tracepoints_ptrs, mod->tracepoints_ptrs + mod->num_tracepoints); --1.8.1.4
Signature · 3 lines
Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com
Quoted 5 lines · Steven Rostedt
No reason to allocate
tp_modulestructures for modules that have no tracepoints. This just wastes memory.Fixes b75ef8b44b1c "Tracepoint: Dissociate from module mutex"Cc [email protected] # 3.2+
Really? CC:stable? To save an insignificant amount of memory?
The definition of stable seems to be shifting away from "fixes for problems with significant effects". I obviously missed the memo.
Rusty.
Quoted 32 lines
Cc Mathieu Desnoyers <[email protected]>Signed-off-by Steven Rostedt <[email protected]>--- kernel/tracepoint.c | 6 ++++++ 1 file changed, 6 insertions(+)kernel/tracepoint.c +6
-0@@ -636,6 +636,9 @@ static int tracepoint_module_coming(struct module *mod)struct tp_module *tp_mod, *iter;int ret =0 ; +if (!mod->num_tracepoints) +return 0 ; +/* * We skip modules that taint the kernel, especially those with different * module headers (for forced load), to make sure we don't cause a crash. @@ -679,6 +682,9 @@ static int tracepoint_module_going(struct module *mod) {struct tp_module *pos; +if (!mod->num_tracepoints) +return 0 ; +mutex_lock (&tracepoints_mutex);tracepoint_update_probe_range (mod->tracepoints_ptrs, mod->tracepoints_ptrs + mod->num_tracepoints);Signature · 1 line
1.8.1.4
Steven Rostedt
maintainerQuoted 8 lines · On Thu, 27 Feb 2014 11:00:35 +1030 Rusty Russell <[email protected]> wrote:
Quoted 5 lines · Steven Rostedt
No reason to allocate
tp_modulestructures for modules that have no tracepoints. This just wastes memory.Fixes b75ef8b44b1c "Tracepoint: Dissociate from module mutex"Cc [email protected] # 3.2+Really? CC:stable? To save an insignificant amount of memory?
I agree that this rational alone is not sufficient for stable. But this is required for another patch that warns when tracepoints are not loaded by a module due to taints. We don't want to warn on all modules.
Quoted 3 lines
The definition of stable seems to be shifting away from "fixes for problems with significant effects". I obviously missed the memo.
Not telling users that tracepoints were not activated, but acting in every other way like they are is to me a "significant effect". This just happened to be something that fixing this depended on.
-- Steve