diff options
author | Steven Rostedt <srostedt@redhat.com> | 2008-05-12 15:20:48 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2008-05-23 14:54:04 -0400 |
commit | 37ad508419f0fdfda7b378756eb1f35cfd26d96d (patch) | |
tree | 53db6e201e605c1926adc74fa965b1a615066da8 /include/linux | |
parent | 088b1e427dbba2af93cb6a7d39258c10ff58dd27 (diff) |
ftrace - fix dynamic ftrace memory leak
The ftrace dynamic function update allocates a record to store the
instruction pointers that are being modified. If the modified
instruction pointer fails to update, then the record is marked as
failed and nothing more is done.
Worse, if the modification fails, but the record ip function is still
called, it will allocate a new record and try again. In just a matter
of time, will this cause a serious memory leak and crash the system.
This patch plugs this memory leak. When a record fails, it is
included back into the pool of records to be used. Now a record may
fail over and over again, but the number of allocated records will
not increase.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/ftrace.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index a842d96c6343..61e757bd2350 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
@@ -43,9 +43,10 @@ extern void mcount(void); | |||
43 | # define FTRACE_HASHSIZE (1<<FTRACE_HASHBITS) | 43 | # define FTRACE_HASHSIZE (1<<FTRACE_HASHBITS) |
44 | 44 | ||
45 | enum { | 45 | enum { |
46 | FTRACE_FL_FAILED = (1 << 0), | 46 | FTRACE_FL_FREE = (1 << 0), |
47 | FTRACE_FL_FILTER = (1 << 1), | 47 | FTRACE_FL_FAILED = (1 << 1), |
48 | FTRACE_FL_ENABLED = (1 << 2), | 48 | FTRACE_FL_FILTER = (1 << 2), |
49 | FTRACE_FL_ENABLED = (1 << 3), | ||
49 | }; | 50 | }; |
50 | 51 | ||
51 | struct dyn_ftrace { | 52 | struct dyn_ftrace { |