linux-uconsole/include
Steven Rostedt 4db6055ac0 ftrace: Fix memory leak with function graph and cpu hotplug
commit 868baf07b1 upstream.

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>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-03-23 13:16:39 -07:00
..
acpi ACPI: skip checking BM_STS if the BIOS doesn't ask for it 2010-08-02 10:21:24 -07:00
asm-generic dma-mapping: fix dma_sync_single_range_* 2010-05-26 14:29:14 -07:00
crypto Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2009-09-11 09:38:37 -07:00
drm drm: fix unsigned vs signed comparison issue in modeset ctl ioctl. 2011-03-07 15:17:52 -08:00
keys RxRPC: Fix v1 keys 2011-03-14 14:29:53 -07:00
linux ftrace: Fix memory leak with function graph and cpu hotplug 2011-03-23 13:16:39 -07:00
math-emu math-emu: correct test for downshifting fraction in _FP_FROM_INT() 2010-08-02 10:20:44 -07:00
media V4L/DVB (13019): video: initial support for ADV7180 2009-09-19 00:53:39 -03:00
mtd
net sctp: Fix oops when sending queued ASCONF chunks 2011-03-07 15:17:55 -08:00
pcmcia PM / yenta: Split resume into early and late parts (rev. 4) 2009-11-03 10:54:58 +01:00
rdma trivial: fix typo "to to" in multiple files 2009-09-21 15:14:55 +02:00
rxrpc
scsi SCSI: fc-transport: Use packed modifier for fc_bsg_request structure. 2010-04-26 07:41:30 -07:00
sound ALSA: emu10k1 - delay the PCM interrupts (add pcm_irq_delay parameter) 2010-08-26 16:41:34 -07:00
trace tracing: Fix ftrace_event_call alignment for use with gcc 4.5 2010-05-12 14:57:14 -07:00
video davinci-fb-frame-buffer-driver-for-ti-da8xx-omap-l1xx-v4 2009-09-23 07:39:51 -07:00
xen
Kbuild