android_kernel_motorola_sm6225/kernel/trace
Steven Rostedt 868baf07b1 ftrace: Fix memory leak with function graph and cpu hotplug
When the fuction graph tracer starts, it needs to make a special
stack for each task to save the real return values of the tasks.
All running tasks have this stack created, as well as any new
tasks.

On CPU hot plug, the new idle task will allocate a stack as well
when init_idle() is called. The problem is that cpu hotplug does
not create a new idle_task. Instead it uses the idle task that
existed when the cpu went down.

ftrace_graph_init_task() will add a new ret_stack to the task
that is given to it. Because a clone will make the task
have a stack of its parent it does not check if the task's
ret_stack is already NULL or not. When the CPU hotplug code
starts a CPU up again, it will allocate a new stack even
though one already existed for it.

The solution is to treat the idle_task specially. In fact, the
function_graph code already does, just not at init_idle().
Instead of using the ftrace_graph_init_task() for the idle task,
which that function expects the task to be a clone, have a
separate ftrace_graph_init_idle_task(). Also, we will create a
per_cpu ret_stack that is used by the idle task. When we call
ftrace_graph_init_idle_task() it will check if the idle task's
ret_stack is NULL, if it is, then it will assign it the per_cpu
ret_stack.

Reported-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Suggested-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2011-02-11 16:23:33 -05:00
..
blktrace.c block: ensure that completion error gets properly traced 2011-01-10 09:06:44 +01:00
ftrace.c ftrace: Fix memory leak with function graph and cpu hotplug 2011-02-11 16:23:33 -05:00
Kconfig perf: Clean up power events by introducing new, more generic ones 2011-01-04 08:16:54 +01:00
Makefile tracing: Fix TRACE_EVENT power tracepoint creation 2011-01-07 23:26:29 -05:00
power-traces.c perf: Clean up power events by introducing new, more generic ones 2011-01-04 08:16:54 +01:00
ring_buffer.c ring_buffer: Off-by-one and duplicate events in ring_buffer_read_page 2010-12-23 12:09:30 -05:00
ring_buffer_benchmark.c ring-buffer: Make benchmark handle missed events 2010-04-27 13:26:58 -04:00
trace.c tracing: Fix preempt count leak 2011-01-07 23:20:02 -05:00
trace.h tracing: Make graph related irqs/preemptsoff functions global 2010-10-18 10:53:28 -04:00
trace_branch.c tracing: Allow events to share their print functions 2010-05-14 14:20:32 -04:00
trace_clock.c Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-08-06 09:39:22 -07:00
trace_entries.h tree-wide: fix comment/printk typos 2010-11-01 15:38:34 -04:00
trace_event_perf.c tracing: New flag to allow non privileged users to use a trace event 2010-11-18 14:37:40 +01:00
trace_events.c tracing: Replace trace_event struct array with pointer array 2011-02-02 21:37:13 -05:00
trace_events_filter.c tracing: Remove test of NULL define_fields callback 2010-06-28 17:12:52 -04:00
trace_export.c tracing: Replace trace_event struct array with pointer array 2011-02-02 21:37:13 -05:00
trace_functions.c tracing: Remove ftrace_preempt_disable/enable 2010-06-03 19:32:38 -04:00
trace_functions_graph.c tracing: Remove parent recording in latency tracer graph options 2010-10-18 10:53:38 -04:00
trace_irqsoff.c lockdep: Move early boot local IRQ enable/disable status to init/main.c 2011-01-20 13:32:33 +01:00
trace_kdb.c kdb,ftdump: Remove reference to internal kdb include 2010-10-22 15:34:11 -05:00
trace_kprobe.c Remove duplicate includes from many files 2010-10-27 18:03:18 -07:00
trace_mmiotrace.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
trace_nop.c tracing/ftrace: make nop-tracer use polling wait for events on pipe 2009-03-23 09:22:15 +01:00
trace_output.c Merge branch 'tip/perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into perf/core 2010-07-23 09:10:29 +02:00
trace_output.h tracing: Allow events to share their print functions 2010-05-14 14:20:32 -04:00
trace_printk.c tracing: Remove markers 2009-09-18 21:22:08 +02:00
trace_sched_switch.c tracing: Let tracepoints have data passed to tracepoint callbacks 2010-05-14 09:50:34 -04:00
trace_sched_wakeup.c tracing: Fix compile issue for trace_sched_wakeup.c 2010-10-19 10:56:19 -04:00
trace_selftest.c sched: Constify function scope static struct sched_param usage 2011-01-07 15:55:45 +01:00
trace_selftest_dynamic.c
trace_stack.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
trace_stat.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
trace_stat.h tracing/stat: Add stat_release() callback 2009-07-10 12:14:05 +02:00
trace_syscalls.c tracing: Replace syscall_meta_data struct array with pointer array 2011-02-03 09:29:06 -05:00
trace_workqueue.c jump label: Initialize workqueue tracepoints *before* they are registered 2010-09-22 16:30:03 -04:00