stack_used() not accurate?
Wenji Huang
wenji.huang@oracle.com
Thu May 29 14:19:00 GMT 2008
Mike Snitzer wrote:
> Hi,
>
> When I use the attached script for all ext3 call-chains stack_used()
> is _always_ 481. I'm running the latest systemtap.git on an RHEL5
> x86_64 system (though older versions of systemtap showed the same
> 481).
>
> I've tested switching the module from ext3 to others and 481 doesn't change.
>
> Looking at tapset/context.stp the implementation for stack_used()
> looks fine. But given the constant 481 I'm seeing is systemtap
> somehow showing systemtap-tainted stack usage?
>
> Mike
Hi Mike,
I did a test and found it kept the constant value. And I changed to
another function which is copied and tailored from check_stack_usage().
The function is added since 2.6.23, but has no much dependency on kernel
version. Seems it works fine on my boxes(x86, x86_64).
function stack_used_new:long() %{ /*pure */
{
unsigned long *n = end_of_stack(current);
unsigned long free;
while (*n == 0)
n++;
free = (unsigned long)n - (unsigned long)end_of_stack(current);
THIS->__retvalue = THREAD_SIZE - free;
}
%}
Regards,
Wenji
More information about the Systemtap
mailing list