* Kernel module to dump Used heap/stack of a user process
@ 2012-05-14 9:56 Dhyan
2012-05-14 10:14 ` 王哲
0 siblings, 1 reply; 4+ messages in thread
From: Dhyan @ 2012-05-14 9:56 UTC (permalink / raw)
To: kernelnewbies
Dear All,
I am writing a kernel module which will accept user process id (PID) as
input and dump all the address space of that user process,like stack,heap
segment.
I took mm->start_brk as start of heap ,mm->brk as end of heap,then i am
seeing, even though user process is not using 33 pages heap size shows as
33 pages
(mm->brk -mm->start_brk) . (This i verified using /proc/pid/maps) .Stack
also behaves in similar way,
*So is there any way i can find out the really used heap staring from
mm->start_brk,So that i can dump only the used heap*
--
Thanks
Dhyan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120514/c4d326ef/attachment.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Kernel module to dump Used heap/stack of a user process
2012-05-14 9:56 Kernel module to dump Used heap/stack of a user process Dhyan
@ 2012-05-14 10:14 ` 王哲
2012-05-15 3:30 ` Dhyan
0 siblings, 1 reply; 4+ messages in thread
From: 王哲 @ 2012-05-14 10:14 UTC (permalink / raw)
To: kernelnewbies
2012/5/14 Dhyan <linuxdhyan@gmail.com>
> Dear All,
>
> I am writing a kernel module which will accept user process id (PID) as
> input and dump all the address space of that user process,like stack,heap
> segment.
>
> I took mm->start_brk as start of heap ,mm->brk as end of heap,then i am
> seeing, even though user process is not using 33 pages heap size shows as
> 33 pages
> (mm->brk -mm->start_brk) . (This i verified using /proc/pid/maps) .Stack
> also behaves in similar way,
>
> *So is there any way i can find out the really used heap staring from
> mm->start_brk,So that i can dump only the used heap*
>
> --
> Thanks
> Dhyan
>
> I am a kernelnewby and used to write a same kernel module.and hope to help
> you.
>
please see the link
http://blog.163.com/zhe_wang_2009/blog/static/17228212120123493614715/
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120514/45ccd020/attachment.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Kernel module to dump Used heap/stack of a user process
2012-05-14 10:14 ` 王哲
@ 2012-05-15 3:30 ` Dhyan
2012-05-15 16:47 ` Mulyadi Santosa
0 siblings, 1 reply; 4+ messages in thread
From: Dhyan @ 2012-05-15 3:30 UTC (permalink / raw)
To: kernelnewbies
Thank you wang zhe for a quick reply.
But my problem as like mentioned is to find out the exact used heap size of
the user process instead of total allocated space.
in cat /proc/pid/mpas i am able to see that whenver a user process forks
kernel allocating almost 33 page size of heap.But if the Process is having
only few dynamic allocation it may be using only few KB heap.
So i just want to find out the exactly used heap not mm->brk or Vm->end of
heap ,so that i can dump only that portion
if anyone knows please help
Thanks
Dhyan
On Mon, May 14, 2012 at 3:44 PM, ?? <wangzhe5004@gmail.com> wrote:
>
>
> 2012/5/14 Dhyan <linuxdhyan@gmail.com>
>
>> Dear All,
>>
>> I am writing a kernel module which will accept user process id (PID) as
>> input and dump all the address space of that user process,like stack,heap
>> segment.
>>
>> I took mm->start_brk as start of heap ,mm->brk as end of heap,then i am
>> seeing, even though user process is not using 33 pages heap size shows as
>> 33 pages
>> (mm->brk -mm->start_brk) . (This i verified using /proc/pid/maps) .Stack
>> also behaves in similar way,
>>
>> *So is there any way i can find out the really used heap staring from
>> mm->start_brk,So that i can dump only the used heap*
>>
>> --
>> Thanks
>> Dhyan
>>
>> I am a kernelnewby and used to write a same kernel module.and hope to
>> help you.
>>
> please see the link
> http://blog.163.com/zhe_wang_2009/blog/static/17228212120123493614715/
>
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120515/50b61d66/attachment.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Kernel module to dump Used heap/stack of a user process
2012-05-15 3:30 ` Dhyan
@ 2012-05-15 16:47 ` Mulyadi Santosa
0 siblings, 0 replies; 4+ messages in thread
From: Mulyadi Santosa @ 2012-05-15 16:47 UTC (permalink / raw)
To: kernelnewbies
Hi...
On Tue, May 15, 2012 at 10:30 AM, Dhyan <linuxdhyan@gmail.com> wrote:
> But my problem as like mentioned is to find out the exact used heap size of
> the user process instead of total allocated space.
try to check how /proc/<pid>/smaps calculate RSS fields....
--
regards,
Mulyadi Santosa
Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-05-15 16:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-14 9:56 Kernel module to dump Used heap/stack of a user process Dhyan
2012-05-14 10:14 ` 王哲
2012-05-15 3:30 ` Dhyan
2012-05-15 16:47 ` Mulyadi Santosa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).