public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Frederic Weisbecker <fweisbec@gmail.com>
Subject: [PATCH 1/6] tracing/function-profiler: do not free per cpu variable stat
Date: Thu, 04 Jun 2009 01:25:41 -0400	[thread overview]
Message-ID: <20090604052612.802684387@goodmis.org> (raw)
In-Reply-To: 20090604052540.528802957@goodmis.org

[-- Attachment #1: 0001-tracing-function-profiler-do-not-free-per-cpu-variab.patch --]
[-- Type: text/plain, Size: 1615 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

The per cpu variable stat is freeded if we fail to allocate a name
on start up. This was due to stat at first being allocated in the
initial design. But since then, it has become a static per cpu variable
but the free on error was not removed.

Also added __init annotation to the function that this is in.

[ Impact: prevent possible memory corruption on low mem at boot up ]

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/ftrace.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index d6973df..134e580 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -766,7 +766,7 @@ static struct tracer_stat function_stats __initdata = {
 	.stat_show	= function_stat_show
 };
 
-static void ftrace_profile_debugfs(struct dentry *d_tracer)
+static __init void ftrace_profile_debugfs(struct dentry *d_tracer)
 {
 	struct ftrace_profile_stat *stat;
 	struct dentry *entry;
@@ -784,7 +784,6 @@ static void ftrace_profile_debugfs(struct dentry *d_tracer)
 			 * The files created are permanent, if something happens
 			 * we still do not free memory.
 			 */
-			kfree(stat);
 			WARN(1,
 			     "Could not allocate stat file for cpu %d\n",
 			     cpu);
@@ -811,7 +810,7 @@ static void ftrace_profile_debugfs(struct dentry *d_tracer)
 }
 
 #else /* CONFIG_FUNCTION_PROFILER */
-static void ftrace_profile_debugfs(struct dentry *d_tracer)
+static __init void ftrace_profile_debugfs(struct dentry *d_tracer)
 {
 }
 #endif /* CONFIG_FUNCTION_PROFILER */
-- 
1.6.3.1

-- 

  reply	other threads:[~2009-06-04  5:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-04  5:25 [PATCH 0/6] [GIT PULL] tracing/branch-profiler: per cpu and other things Steven Rostedt
2009-06-04  5:25 ` Steven Rostedt [this message]
2009-06-04  5:25 ` [PATCH 2/6] tracing/branch-profiler: fix return value check on register_stat_tracer Steven Rostedt
2009-06-04  5:25 ` [PATCH 3/6] tracing/branch-profiler: do not profile managers Steven Rostedt
2009-06-04  5:25 ` [PATCH 4/6] tracing/branch-profiler: move macro defines to kernel.h Steven Rostedt
2009-06-04  5:25 ` [PATCH 5/6] tracing/branch-profiling: add variable to disable branch profiling Steven Rostedt
2009-06-04  5:25 ` [PATCH 6/6] tracing/branch-profiler: add option to profile branches per cpu Steven Rostedt
2009-06-06  7:31 ` [PATCH 0/6] [GIT PULL] tracing/branch-profiler: per cpu and other things Ingo Molnar
2009-06-06 14:37   ` [PATCH] tracing/branch-tracer: PROFILE_BRANCHES_PER_CPU must depend on SMP Frederic Weisbecker
2009-06-06 14:42     ` Steven Rostedt
2009-06-06 14:56       ` Frederic Weisbecker
2009-06-07 13:44     ` Ingo Molnar

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=20090604052612.802684387@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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