[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Libunwind-devel] Updated fast trace patch with initial performance
From: |
Paul Pluzhnikov |
Subject: |
Re: [Libunwind-devel] Updated fast trace patch with initial performance results |
Date: |
Tue, 5 Apr 2011 14:08:14 -0700 |
On Mon, Apr 4, 2011 at 9:26 PM, Paul Pluzhnikov <address@hidden> wrote:
> On Mon, Apr 4, 2011 at 9:01 PM, Arun Sharma <address@hidden> wrote:
>
>> Could you also add a test case to Ltest-nomalloc, so we catch any
>> mallocs in the fast unwind path? Thanks.
>
> That may not be easy: AFAICT glibc pthread_setspecific doesn't call
> calloc all the time; only when there are more than
> PTHREAD_KEY_2NDLEVEL_SIZE (== 32) keys, and even then only the first
> time for a block of keys.
>
> I'll try to make a test case anyway.
Attached patch makes a new Ltest-nocalloc test, and shows 1 calloc call
from Lassi's backtrace() on Ubuntu/glibc-2.11/x86_64 system:
FAILURE: detected 1 error (malloc: 0, calloc: 1)
Just as a sanity check, I ran it in GDB, and confirmed the expected
stack trace:
Breakpoint 2, calloc (n=32, s=16) at ../../tests/Gtest-nocalloc.c:60
60 if (in_unwind) {
(gdb) bt
#0 calloc (n=32, s=16) at ../../tests/Gtest-nocalloc.c:60
#1 0x00007ffff79c5ac9 in __pthread_setspecific (key=100,
value=0x7ffff7fb91f0) at pthread_setspecific.c:73
#2 0x00007ffff7fe4638 in trace_cache_get (cursor=0x7fffffffc6e0,
buffer=0x7fffffffd2d0, size=0x7fffffffd29c) at
../../src/x86_64/Gtrace.c:175
#3 _ULx86_64_tdep_trace (cursor=0x7fffffffc6e0, buffer=0x7fffffffd2d0,
size=0x7fffffffd29c) at ../../src/x86_64/Gtrace.c:424
#4 0x00007ffff7fe250e in unw_backtrace (buffer=0x7fffffffd2d0, size=100)
at ../../src/mi/backtrace.c:69
#5 0x0000000000400a28 in do_backtrace () at ../../tests/Gtest-nocalloc.c:91
#6 0x0000000000400b2d in foo3 (argc=<value optimized out>, argv=<value
optimized out>) at ../../tests/Gtest-nocalloc.c:98
#7 foo2 (argc=<value optimized out>, argv=<value optimized out>) at
../../tests/Gtest-nocalloc.c:104
#8 foo1 (argc=<value optimized out>, argv=<value optimized out>) at
../../tests/Gtest-nocalloc.c:110
#9 main (argc=<value optimized out>, argv=<value optimized out>) at
../../tests/Gtest-nocalloc.c:126
Now all we have to do is figure out how to fix it ;-)
Thanks,
--
Paul Pluzhnikov
add-nocalloc.patch
Description: Text Data