stack_used() not accurate?
Mike Snitzer
snitzer@gmail.com
Thu May 29 18:02:00 GMT 2008
On Thu, May 29, 2008 at 10:48 AM, Frank Ch. Eigler <fche@redhat.com> wrote:
> Wenji Huang <wenji.huang@oracle.com> writes:
>
>> [...] I did a test and found it kept the constant value.
>
> If the kernel switches to a separate stack for int3 handling, that
> could explain the constant value.
Thanks for the explanation.
>> 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;
>> }
>> %}
>
> This searching for non-0 values seems dangerously unbounded. Plus it
> may measure the *maximum historical* rather current stack usage.
Yes, when using Wenji's stack_used_new() I'm seeing free=0 quite
frequently; obviously that isn't useful/accurate.
I'll be exploring other implementations, but any suggestions would be
very welcome.
Mike
More information about the Systemtap
mailing list