public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tracing/uprobes: fix uprobe_cpu_buffer memory leak
@ 2014-04-17  8:05 zhangwei(Jovi)
  0 siblings, 0 replies; 3+ messages in thread
From: zhangwei(Jovi) @ 2014-04-17  8:05 UTC (permalink / raw)
  To: Steven Rostedt, Namhyung Kim
  Cc: Masami Hiramatsu, Oleg Nesterov, linux-kernel@vger.kernel.org

Forgot to free uprobe_cpu_buffer percpu page in uprobe_buffer_disable.

Signed-off-by: zhangwei(Jovi) <jovi.zhangwei@huawei.com>
---
 kernel/trace/trace_uprobe.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index e447336..071d3bb 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -729,9 +729,15 @@ static int uprobe_buffer_enable(void)

 static void uprobe_buffer_disable(void)
 {
+	int cpu;
+
 	BUG_ON(!mutex_is_locked(&event_mutex));

 	if (--uprobe_buffer_refcnt == 0) {
+		for_each_possible_cpu(cpu)
+			free_page((unsigned long)per_cpu_ptr(uprobe_cpu_buffer,
+							     cpu)->buf);
+
 		free_percpu(uprobe_cpu_buffer);
 		uprobe_cpu_buffer = NULL;
 	}
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* Re: [PATCH] tracing/uprobes: fix uprobe_cpu_buffer memory leak
@ 2014-04-17 13:31 Namhyung Kim
  2014-04-17 14:43 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Namhyung Kim @ 2014-04-17 13:31 UTC (permalink / raw)
  To: zhangwei(Jovi)
  Cc: Steven Rostedt, Namhyung Kim, Masami Hiramatsu, Oleg Nesterov,
	linux-kernel@vger.kernel.org

Hi Jovi,

(Sorry for replying in another thread.  I don't have an access to the
company mail at home.)

On Thu, Apr 17, 2014 at 04:05:19PM +0800, "zhangwei(Jovi)" wrote:
> Forgot to free uprobe_cpu_buffer percpu page in uprobe_buffer_disable.

Thanks for fixing this!

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-17 14:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-17  8:05 [PATCH] tracing/uprobes: fix uprobe_cpu_buffer memory leak zhangwei(Jovi)
  -- strict thread matches above, loose matches on Subject: below --
2014-04-17 13:31 Namhyung Kim
2014-04-17 14:43 ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox