[PATCH] x86-64: do not always end the stack trace with ULONG_MAX

It makes more sense to end the stack trace with ULONG_MAX only if
nr_entries < max_entries.  Otherwise, we lose one entry in the long stack
traces and cannot know whether the trace was complete or not.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Andi Kleen <ak@suse.de>
Cc: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
This commit is contained in:
Catalin Marinas
2007-02-13 13:26:21 +01:00
committed by Andi Kleen
parent 5558870bfb
commit 006e84ee3a

View File

@@ -32,7 +32,7 @@ static void save_stack_address(void *data, unsigned long addr)
trace->skip--; trace->skip--;
return; return;
} }
if (trace->nr_entries < trace->max_entries - 1) if (trace->nr_entries < trace->max_entries)
trace->entries[trace->nr_entries++] = addr; trace->entries[trace->nr_entries++] = addr;
} }
@@ -49,6 +49,7 @@ static struct stacktrace_ops save_stack_ops = {
void save_stack_trace(struct stack_trace *trace, struct task_struct *task) void save_stack_trace(struct stack_trace *trace, struct task_struct *task)
{ {
dump_trace(task, NULL, NULL, &save_stack_ops, trace); dump_trace(task, NULL, NULL, &save_stack_ops, trace);
if (trace->nr_entries < trace->max_entries)
trace->entries[trace->nr_entries++] = ULONG_MAX; trace->entries[trace->nr_entries++] = ULONG_MAX;
} }
EXPORT_SYMBOL(save_stack_trace); EXPORT_SYMBOL(save_stack_trace);