• Paolo Bonzini's avatar
    coroutine-ucontext: use __thread · d1d1b206
    Paolo Bonzini authored
    ELF thread local storage is about 10% faster on tests/test-coroutine's
    perf/cost test.  The timing on my machine is 190ns per iteration with
    pthread TLS, 170 with ELF TLS.
    
    Based on a patch by Kevin Wolf and Peter Lieven, but redone to follow
    the model of coroutine-win32.c (including the important "noinline"
    attribute!).
    
    Platforms without thread-local storage (OpenBSD probably?) will need
    a new-enough GCC for this to compile, in order to use the same emutls
    support that Windows already relies on.
    Signed-off-by: 's avatarPaolo Bonzini <pbonzini@redhat.com>
    Reviewed-by: 's avatarFam Zheng <famz@redhat.com>
    Message-id: 1417518350-6167-2-git-send-email-pbonzini@redhat.com
    Signed-off-by: 's avatarStefan Hajnoczi <stefanha@redhat.com>
    d1d1b206
coroutine-ucontext.c 5.06 KB