summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/ftrace.h6
-rw-r--r--init/main.c1
-rw-r--r--kernel/trace/ftrace.c7
-rw-r--r--mm/page_alloc.c3
4 files changed, 8 insertions, 9 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 0276a2c487e6..ef7123219f14 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -147,9 +147,9 @@ struct ftrace_ops_hash {
147 struct mutex regex_lock; 147 struct mutex regex_lock;
148}; 148};
149 149
150void ftrace_free_mem(void *start, void *end); 150void ftrace_free_init_mem(void);
151#else 151#else
152static inline void ftrace_free_mem(void *start, void *end) { } 152static inline void ftrace_free_init_mem(void) { }
153#endif 153#endif
154 154
155/* 155/*
@@ -266,7 +266,7 @@ static inline int ftrace_nr_registered_ops(void)
266} 266}
267static inline void clear_ftrace_function(void) { } 267static inline void clear_ftrace_function(void) { }
268static inline void ftrace_kill(void) { } 268static inline void ftrace_kill(void) { }
269static inline void ftrace_free_mem(void *start, void *end) { } 269static inline void ftrace_free_init_mem(void) { }
270#endif /* CONFIG_FUNCTION_TRACER */ 270#endif /* CONFIG_FUNCTION_TRACER */
271 271
272#ifdef CONFIG_STACK_TRACER 272#ifdef CONFIG_STACK_TRACER
diff --git a/init/main.c b/init/main.c
index c0137b916aa1..0e8849f74561 100644
--- a/init/main.c
+++ b/init/main.c
@@ -962,6 +962,7 @@ static int __ref kernel_init(void *unused)
962 kernel_init_freeable(); 962 kernel_init_freeable();
963 /* need to finish all async __init code before freeing the memory */ 963 /* need to finish all async __init code before freeing the memory */
964 async_synchronize_full(); 964 async_synchronize_full();
965 ftrace_free_init_mem();
965 free_initmem(); 966 free_initmem();
966 mark_readonly(); 967 mark_readonly();
967 system_state = SYSTEM_RUNNING; 968 system_state = SYSTEM_RUNNING;
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index aff7a2c08387..8efd9fe7aec0 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -36,6 +36,7 @@
36 36
37#include <trace/events/sched.h> 37#include <trace/events/sched.h>
38 38
39#include <asm/sections.h>
39#include <asm/setup.h> 40#include <asm/setup.h>
40 41
41#include "trace_output.h" 42#include "trace_output.h"
@@ -5279,10 +5280,10 @@ void ftrace_module_init(struct module *mod)
5279} 5280}
5280#endif /* CONFIG_MODULES */ 5281#endif /* CONFIG_MODULES */
5281 5282
5282void ftrace_free_mem(void *start_ptr, void *end_ptr) 5283void __init ftrace_free_init_mem(void)
5283{ 5284{
5284 unsigned long start = (unsigned long)start_ptr; 5285 unsigned long start = (unsigned long)(&__init_begin);
5285 unsigned long end = (unsigned long)end_ptr; 5286 unsigned long end = (unsigned long)(&__init_end);
5286 struct ftrace_page **last_pg = &ftrace_pages_start; 5287 struct ftrace_page **last_pg = &ftrace_pages_start;
5287 struct ftrace_page *pg; 5288 struct ftrace_page *pg;
5288 struct dyn_ftrace *rec; 5289 struct dyn_ftrace *rec;
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index eee82bfb7cd8..178bf9c2a2cb 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6606,9 +6606,6 @@ unsigned long free_reserved_area(void *start, void *end, int poison, char *s)
6606 void *pos; 6606 void *pos;
6607 unsigned long pages = 0; 6607 unsigned long pages = 0;
6608 6608
6609 /* This may be .init text, inform ftrace to remove it */
6610 ftrace_free_mem(start, end);
6611
6612 start = (void *)PAGE_ALIGN((unsigned long)start); 6609 start = (void *)PAGE_ALIGN((unsigned long)start);
6613 end = (void *)((unsigned long)end & PAGE_MASK); 6610 end = (void *)((unsigned long)end & PAGE_MASK);
6614 for (pos = start; pos < end; pos += PAGE_SIZE, pages++) { 6611 for (pos = start; pos < end; pos += PAGE_SIZE, pages++) {