stack_used() not accurate?

Frank Ch. Eigler fche@redhat.com
Thu May 29 16:31:00 GMT 2008


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.

> 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.


- FChE



More information about the Systemtap mailing list