[PATCH] kretprobe instance recycled by parent process
When kretprobe probes the schedule() function, if the probed process exits then schedule() will never return, so some kretprobe instances will never be recycled. In this patch the parent process will recycle retprobe instances of the probed function and there will be no memory leak of kretprobe instances. Signed-off-by: bibo mao <bibo.mao@intel.com> Cc: Masami Hiramatsu <hiramatu@sdl.hitachi.co.jp> Cc: Prasanna S Panchamukhi <prasanna@in.ibm.com> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
#include <linux/syscalls.h>
|
||||
#include <linux/times.h>
|
||||
#include <linux/acct.h>
|
||||
#include <linux/kprobes.h>
|
||||
#include <asm/tlb.h>
|
||||
|
||||
#include <asm/unistd.h>
|
||||
@@ -1546,8 +1547,14 @@ static inline void finish_task_switch(runqueue_t *rq, task_t *prev)
|
||||
finish_lock_switch(rq, prev);
|
||||
if (mm)
|
||||
mmdrop(mm);
|
||||
if (unlikely(prev_task_flags & PF_DEAD))
|
||||
if (unlikely(prev_task_flags & PF_DEAD)) {
|
||||
/*
|
||||
* Remove function-return probe instances associated with this
|
||||
* task and put them back on the free list.
|
||||
*/
|
||||
kprobe_flush_task(prev);
|
||||
put_task_struct(prev);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user