This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
RE: How can I trace when the allocated memory is free after kmalloc ?
Hi Mark.
Thanks for your help.
But vm.kfree is not working. ( make target phone reset )
( vm.kmalloc is ok .)
Below is my test code .
-------------------------------------
probe vm.kfree { println(vm.kfree \n")}
-------------------------------------
please recommand what I should try .
My environment is
- target OS : Android OS kernel ver 2.6.35.11
- host : Ubuntu 11.04 64bit.
- systemtap ver :systemtap-20110917.tar.bz2
-----Original Message-----
From: Mark Wielaard [mailto:mjw@redhat.com]
Sent: Friday, September 16, 2011 7:04 PM
To: ììíB
Cc: 'Turgis, Frederic'; 'Josh Stone'; systemtap@sourceware.org
Subject: Re: How can I trace when the allocated memory is free after kmalloc ?
On Fri, 2011-09-16 at 17:19 +0900, ììíB wrote:
> Hi Mark.
>
> If "A thead" get a kernel memory by kmalloc, and "B thead" can free the memory,
> how can I trace when the allocated memory is returned after kmalloc ?
I suppose you can save the address that kmalloc returned and check for
that address while probing kfree. Maybe something like:
global addrs;
probe vm.kmalloc
{
addrs[ptr] = get_cycles();
}
probe vm.kfree
{
if (addrs[ptr] != 0)
{
printf("%x released after %d cycles\n",
ptr, get_cycles() - addrs[ptr]);
}
delete(addrs[ptr]);
}
That will probably overflow MAXMAPENTRIES pretty quickly though.
Cheers,
Mark