* Peter Zijlstra <[email protected]> wrote:
> Andrew worried about the overhead on small systems; only use the fancy
> code when either perf or tracing is enabled.
>
> Cc: Rusty Russell <[email protected]>
> Cc: Steven Rostedt <[email protected]>
> Requested-by: Andrew Morton <[email protected]>
> Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
> ---
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/