From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932648AbbDMQxU (ORCPT ); Mon, 13 Apr 2015 12:53:20 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:38525 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932081AbbDMQxS (ORCPT ); Mon, 13 Apr 2015 12:53:18 -0400 Date: Mon, 13 Apr 2015 18:53:13 +0200 From: Ingo Molnar To: Peter Zijlstra Cc: rusty@rustcorp.com.au, mathieu.desnoyers@efficios.com, oleg@redhat.com, paulmck@linux.vnet.ibm.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, andi@firstfloor.org, rostedt@goodmis.org, tglx@linutronix.de, laijs@cn.fujitsu.com, linux@horizon.com, Andrew Morton Subject: Re: [PATCH v5 08/10] module: Make the mod_tree stuff conditional on PERF_EVENTS || TRACING Message-ID: <20150413165313.GG6040@gmail.com> References: <20150413141126.756350256@infradead.org> <20150413141213.670948731@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150413141213.670948731@infradead.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Peter Zijlstra wrote: > Andrew worried about the overhead on small systems; only use the fancy > code when either perf or tracing is enabled. > > Cc: Rusty Russell > Cc: Steven Rostedt > Requested-by: Andrew Morton > Signed-off-by: Peter Zijlstra (Intel) > --- > 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