Messages in this thread | | | Date | Mon, 13 Apr 2015 18:53:13 +0200 | From | Ingo Molnar <> | Subject | Re: [PATCH v5 08/10] module: Make the mod_tree stuff conditional on PERF_EVENTS || TRACING |
| |
* Peter Zijlstra <peterz@infradead.org> wrote:
> Andrew worried about the overhead on small systems; only use the fancy > code when either perf or tracing is enabled. > > Cc: Rusty Russell <rusty@rustcorp.com.au> > Cc: Steven Rostedt <rostedt@goodmis.org> > Requested-by: Andrew Morton <akpm@linux-foundation.org> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> > --- > kernel/module.c | 30 ++++++++++++++++++++++++++++-- > 1 file changed, 28 insertions(+), 2 deletions(-) > > --- a/kernel/module.c > +++ b/kernel/module.c > @@ -102,6 +102,8 @@ DEFINE_MUTEX(module_mutex); > EXPORT_SYMBOL_GPL(module_mutex); > static LIST_HEAD(modules); > > +#if defined(CONFIG_PERF_EVENTS) || defined(CONFIG_TRACING) > + > /* > * Use a latched RB-tree for __module_address(); this allows us to use > * RCU-sched lookups of the address from any context. > @@ -112,6 +114,10 @@ static LIST_HEAD(modules); > * > * Because init ranges are short lived we mark them unlikely and have placed > * them outside the critical cacheline in struct module. > + * > + * This is conditional on PERF_EVENTS || TRACING because those can really hit > + * __module_address() hard by doing a lot of stack unwinding; potentially from > + * NMI context.
So I think we'd be better off introducing a helper Kconfig bool for that, CONFIG_MODULE_LATCHED_LOOKUPS or so, and select that symbol from the perf and tracing Kconfig code directly?
Beyond it being a cleaner, self-maintaining construct, that would also allow other subsystems to set it as well, without having to modify kernel/module.c.
Thanks,
Ingo
| |