public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [RFC][PATCH] tracepoint: Do not waste memory on mods with no tracepoints
Date: Wed, 26 Feb 2014 17:20:34 +0000 (UTC)	[thread overview]
Message-ID: <118766423.31006.1393435234610.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <20140226110313.4d92fb83@gandalf.local.home>

----- Original Message -----
> From: "Steven Rostedt" <rostedt@goodmis.org>
> To: "LKML" <linux-kernel@vger.kernel.org>
> Cc: "Ingo Molnar" <mingo@kernel.org>, "Rusty Russell" <rusty@rustcorp.com.au>, "Peter Zijlstra"
> <peterz@infradead.org>, "Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>, "Andrew Morton"
> <akpm@linux-foundation.org>
> Sent: Wednesday, February 26, 2014 11:03:13 AM
> Subject: [RFC][PATCH] 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.

Good catch! Thanks!

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

> 
> Fixes: b75ef8b44b1c "Tracepoint: Dissociate from module mutex"
> Cc: stable@vger.kernel.org # 3.2+
> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
>  kernel/tracepoint.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
> index 29f2654..0d4ef26 100644
> --- a/kernel/tracepoint.c
> +++ b/kernel/tracepoint.c
> @@ -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
> 
> 

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

  reply	other threads:[~2014-02-26 17:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-26 16:03 [RFC][PATCH] tracepoint: Do not waste memory on mods with no tracepoints Steven Rostedt
2014-02-26 17:20 ` Mathieu Desnoyers [this message]
2014-02-27  0:30 ` Rusty Russell
2014-02-27  1:42   ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=118766423.31006.1393435234610.JavaMail.zimbra@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox