cgroups: fix a race between cgroup_clone and umount
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / sh / kernel / stacktrace.c
blob54d1f61aa00778c22cb55552e5fc18197e12d3b8
1 /*
2 * arch/sh/kernel/stacktrace.c
4 * Stack trace management functions
6 * Copyright (C) 2006 Paul Mundt
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
12 #include <linux/sched.h>
13 #include <linux/stacktrace.h>
14 #include <linux/thread_info.h>
15 #include <linux/module.h>
16 #include <asm/ptrace.h>
19 * Save stack-backtrace addresses into a stack_trace buffer.
21 void save_stack_trace(struct stack_trace *trace)
23 unsigned long *sp = (unsigned long *)current_stack_pointer;
25 while (!kstack_end(sp)) {
26 unsigned long addr = *sp++;
28 if (__kernel_text_address(addr)) {
29 if (trace->skip > 0)
30 trace->skip--;
31 else
32 trace->entries[trace->nr_entries++] = addr;
33 if (trace->nr_entries >= trace->max_entries)
34 break;
38 EXPORT_SYMBOL_GPL(save_stack_trace);