2006-02-15 03:39:28

by Zhou Yingchao

[permalink] [raw]
Subject: Fwd: [PATCH] kretprobe instance recycled by parent process

2006/2/15, bibo mao <[email protected]>:
> When kretprobe probe schedule() function, if probed process exit then
> schedule() function will never return, so some kretprobe instance will
> never be recycled. By this patch the parent process will recycle
> retprobe instance of probed function, there will be no memory leak of
> kretprobe instance. This patch is based on 2.6.16-rc3.

Is there any process which can exit without go through the do_exit() path?
--
Yingchao Zhou
***********************************************
Institute Of Computing Technology
Chinese Academy of Sciences
Tel(O) : 010-62613792-28
***********************************************


--
Yingchao Zhou
***********************************************
Institute Of Computing Technology
Chinese Academy of Sciences
Tel(O) : 010-62613792-28
***********************************************


2006-02-15 04:57:32

by bibo,mao

[permalink] [raw]
Subject: Re: Fwd: [PATCH] kretprobe instance recycled by parent process

Zhou Yingchao wrote:
> 2006/2/15, bibo mao <[email protected]>:
>> When kretprobe probe schedule() function, if probed process exit then
>> schedule() function will never return, so some kretprobe instance will
>> never be recycled. By this patch the parent process will recycle
>> retprobe instance of probed function, there will be no memory leak of
>> kretprobe instance. This patch is based on 2.6.16-rc3.
>
> Is there any process which can exit without go through the do_exit() path?
> --
When process exits through do_exit() function, it will call schedule()
function. But if schedule() function is probed by kretprobe, this time
schedule() function will not return never because process has exited.

bibo,mao

2006-02-15 05:59:04

by Zhou Yingchao

[permalink] [raw]
Subject: Re: Fwd: [PATCH] kretprobe instance recycled by parent process

> >> When kretprobe probe schedule() function, if probed process exit then
> >> schedule() function will never return, so some kretprobe instance will
> >> never be recycled. By this patch the parent process will recycle
> >> retprobe instance of probed function, there will be no memory leak of
> >> kretprobe instance. This patch is based on 2.6.16-rc3.
> >
> > Is there any process which can exit without go through the do_exit() path?
> > --
> When process exits through do_exit() function, it will call schedule()
> function. But if schedule() function is probed by kretprobe, this time
> schedule() function will not return never because process has exited.
>
> bibo,mao
>

In the original path, doesn't the call path of
do_exit()->exit_thread()->kprobe_flush_task(current) recycle the
kretprobe instance? Is there anything misundstood?
--
Yingchao Zhou
***********************************************
Institute Of Computing Technology
Chinese Academy of Sciences
Tel(O) : 010-62613792-28
***********************************************

2006-02-15 06:22:59

by bibo,mao

[permalink] [raw]
Subject: Re: Fwd: [PATCH] kretprobe instance recycled by parent process

Zhou Yingchao wrote:
>>>> When kretprobe probe schedule() function, if probed process exit then
>>>> schedule() function will never return, so some kretprobe instance will
>>>> never be recycled. By this patch the parent process will recycle
>>>> retprobe instance of probed function, there will be no memory leak of
>>>> kretprobe instance. This patch is based on 2.6.16-rc3.
>>> Is there any process which can exit without go through the do_exit() path?
>>> --
>> When process exits through do_exit() function, it will call schedule()
>> function. But if schedule() function is probed by kretprobe, this time
>> schedule() function will not return never because process has exited.
>>
>> bibo,mao
>>
>
> In the original path, doesn't the call path of
> do_exit()->exit_thread()->kprobe_flush_task(current) recycle the
> kretprobe instance? Is there anything misundstood?
> --
yes, it is right. The old recycle method is
do_exit()->exit_thread()->kprobe_flush_task(current)
->schedule()
At last line of do_exit() it will call schedule() function, and this
time it will never return. But if schedule function is probed, who is
responsible for recycling it?

bibo,mao