Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Jun 2003 17:35:56 -0700
From:      Marcel Moolenaar <marcel@xcllnt.net>
To:        David Xu <davidxu@viatech.com.cn>
Cc:        aritger@nvidia.com
Subject:   Re: Nvidia, TLS and __thread keyword -- an observation
Message-ID:  <20030618003556.GA2440@dhcp01.pn.xcllnt.net>
In-Reply-To: <002101c3352a$e931a7f0$0701a8c0@tiger>
References:  <20030617223910.GB57040@ns1.xcllnt.net> <002101c3352a$e931a7f0$0701a8c0@tiger>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jun 18, 2003 at 07:48:09AM +0800, David Xu wrote:
> 
> > The static TLS model requires the least amount of work: add support
> > to allocate the TLS image for every thread creation and point the
> > thread pointer to it in a way compatible with the runtime spec.
> > 
> > The dynamic TLS model requires more substantial changes and involves
> > RTLD as well. This is the model that requires __tls_get_addr().
> > 
> 
> I believe this will add overhead to thread creating and destroying,
> How fast an RTLD can be in this case ?

In the dynamic TLS model you would like to delay the creation of
the TLS space. Normally __tls_get_addr() gets used for this. In
the static TLS model you allocate the TLS when you llocate the
thread control structure.

Thus, there's virtually no cost. However TLS accesses for the
dynamic TLS model are expensive. I have some ideas about that.
With some kernel support you can even create dynamic TLS with
static TLS code sequences...

-- 
 Marcel Moolenaar	  USPA: A-39004		 marcel@xcllnt.net



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030618003556.GA2440>