aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/stacktrace.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2010-06-03 15:32:43 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2010-06-09 11:32:19 -0400
commit018378c55b03f88ff513aba4e0e93b8d4a9cf241 (patch)
treeaffdac6f6d78623e1d13d53feee25f43d4eacee7 /arch/x86/kernel/stacktrace.c
parent147ec4d2361e355ab32499f739cc24845ceb89da (diff)
x86: Unify save_stack_address() and save_stack_address_nosched()
Cleanup. Factor the common code in save_stack_address() and save_stack_address_nosched(). Signed-off-by: Oleg Nesterov <oleg@redhat.com> Cc: Roland McGrath <roland@redhat.com> Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: Vegard Nossum <vegard.nossum@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> LKML-Reference: <20100603193243.GA31534@redhat.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'arch/x86/kernel/stacktrace.c')
-rw-r--r--arch/x86/kernel/stacktrace.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c
index abc321d55870..b53c525368a7 100644
--- a/arch/x86/kernel/stacktrace.c
+++ b/arch/x86/kernel/stacktrace.c
@@ -23,13 +23,16 @@ static int save_stack_stack(void *data, char *name)
23 return 0; 23 return 0;
24} 24}
25 25
26static void save_stack_address(void *data, unsigned long addr, int reliable) 26static void
27__save_stack_address(void *data, unsigned long addr, bool reliable, bool nosched)
27{ 28{
28 struct stack_trace *trace = data; 29 struct stack_trace *trace = data;
29#ifdef CONFIG_FRAME_POINTER 30#ifdef CONFIG_FRAME_POINTER
30 if (!reliable) 31 if (!reliable)
31 return; 32 return;
32#endif 33#endif
34 if (nosched && in_sched_functions(addr))
35 return;
33 if (trace->skip > 0) { 36 if (trace->skip > 0) {
34 trace->skip--; 37 trace->skip--;
35 return; 38 return;
@@ -38,22 +41,15 @@ static void save_stack_address(void *data, unsigned long addr, int reliable)
38 trace->entries[trace->nr_entries++] = addr; 41 trace->entries[trace->nr_entries++] = addr;
39} 42}
40 43
44static void save_stack_address(void *data, unsigned long addr, int reliable)
45{
46 return __save_stack_address(data, addr, reliable, false);
47}
48
41static void 49static void
42save_stack_address_nosched(void *data, unsigned long addr, int reliable) 50save_stack_address_nosched(void *data, unsigned long addr, int reliable)
43{ 51{
44 struct stack_trace *trace = data; 52 return __save_stack_address(data, addr, reliable, true);
45#ifdef CONFIG_FRAME_POINTER
46 if (!reliable)
47 return;
48#endif
49 if (in_sched_functions(addr))
50 return;
51 if (trace->skip > 0) {
52 trace->skip--;
53 return;
54 }
55 if (trace->nr_entries < trace->max_entries)
56 trace->entries[trace->nr_entries++] = addr;
57} 53}
58 54
59static const struct stacktrace_ops save_stack_ops = { 55static const struct stacktrace_ops save_stack_ops = {