qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: Stefan Hajnoczi <stefanha@gmail.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qemu-thread: add TLS wrappers
Date: Wed, 17 Aug 2011 11:03:26 -0700	[thread overview]
Message-ID: <4E4C026E.4070200@redhat.com> (raw)
In-Reply-To: <CAAu8pHsk-dwf+5038+H4AzU8pF3C+Vx0g8ChQV8vwncx6XwhFA@mail.gmail.com>

On 08/17/2011 10:51 AM, Blue Swirl wrote:
> >  Visual C++ supports __declspec(thread).
> >
> >  pthread TLS is orders of magnitudes slower than __thread.  __thread in an
> >  executable is just as fast as a non-TLS variable access, 2 or 3 machine
> >  language instructions at most.
> >
> >  Some pthread_getspecific implementation do a_linear walk_  of the keys.  In
> >  that case it may work to have something like Windows plus a single
> >  pthread_getspecific key.  On the other hand, Windows provides very good
> >  support for that thanks to its ordered subsections (.tls$something).  It
> >  only needs a bit of preprocessor magic.  Thinks such as linker scripts would
> >  be way out of scope.
>
> According to this blog, also pthread_getspecific on OSX can amount to
> three instructions except on PPC:
> http://lifecs.likai.org/2010/05/mac-os-x-thread-local-storage.html

I'll try to work out a DEFINE_TLS/DECLARE_TLS version for pthreads too.

BTW, __thread is in C1X too though I don't remember how they called it.

Paolo

  reply	other threads:[~2011-08-17 18:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-16 18:51 [Qemu-devel] [PATCH] qemu-thread: add TLS wrappers Paolo Bonzini
2011-08-17  4:36 ` Brad
2011-08-17  6:55   ` Paolo Bonzini
2011-08-17 17:28     ` Blue Swirl
2011-08-17 17:37       ` Paolo Bonzini
2011-08-17 19:00       ` Richard Henderson
2011-08-17 23:50         ` Brad
2011-08-17 23:51           ` Paolo Bonzini
2011-08-17 16:51 ` Stefan Hajnoczi
2011-08-17 17:13   ` Paolo Bonzini
2011-08-17 17:26     ` Stefan Hajnoczi
2011-08-17 17:28       ` Paolo Bonzini
2011-08-17 17:37         ` Blue Swirl
2011-08-17 17:45           ` Paolo Bonzini
2011-08-17 17:51             ` Blue Swirl
2011-08-17 18:03               ` Paolo Bonzini [this message]
2011-08-17 18:32                 ` malc
2011-08-17 23:41           ` Brad
2011-08-17 17:34     ` Blue Swirl
2011-08-17 17:38       ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E4C026E.4070200@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).