From owner-freebsd-threads@FreeBSD.ORG Tue Jun 17 17:36:29 2003 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5B57037B401 for ; Tue, 17 Jun 2003 17:36:29 -0700 (PDT) Received: from ns1.xcllnt.net (209-128-86-226.BAYAREA.NET [209.128.86.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8853643FD7 for ; Tue, 17 Jun 2003 17:36:28 -0700 (PDT) (envelope-from marcel@xcllnt.net) Received: from dhcp01.pn.xcllnt.net (dhcp01.pn.xcllnt.net [192.168.4.201]) by ns1.xcllnt.net (8.12.9/8.12.9) with ESMTP id h5I0ZuDZ058380; Tue, 17 Jun 2003 17:35:56 -0700 (PDT) (envelope-from marcel@piii.pn.xcllnt.net) Received: from dhcp01.pn.xcllnt.net (localhost [127.0.0.1]) by dhcp01.pn.xcllnt.net (8.12.9/8.12.9) with ESMTP id h5I0Zust002506; Tue, 17 Jun 2003 17:35:56 -0700 (PDT) (envelope-from marcel@dhcp01.pn.xcllnt.net) Received: (from marcel@localhost) by dhcp01.pn.xcllnt.net (8.12.9/8.12.9/Submit) id h5I0Zutd002505; Tue, 17 Jun 2003 17:35:56 -0700 (PDT) (envelope-from marcel) Date: Tue, 17 Jun 2003 17:35:56 -0700 From: Marcel Moolenaar To: David Xu Message-ID: <20030618003556.GA2440@dhcp01.pn.xcllnt.net> References: <20030617223910.GB57040@ns1.xcllnt.net> <002101c3352a$e931a7f0$0701a8c0@tiger> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <002101c3352a$e931a7f0$0701a8c0@tiger> User-Agent: Mutt/1.5.4i cc: threads@freebsd.org cc: gareth@nvidia.com cc: Julian Elischer cc: aritger@nvidia.com Subject: Re: Nvidia, TLS and __thread keyword -- an observation X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jun 2003 00:36:29 -0000 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