[PATCH] Native POSIX Thread Library(NPTL) ARM Supporting Patches (1/3)

Philip Blundell pb@nexus.co.uk
Thu May 29 14:15:00 GMT 2003


On Fri, 2003-05-23 at 09:23, Hu, Boris wrote:
> However, TLS is absent in arm toolchain. So here is a work-around way. 
> In the linux kernel, a thread register is simulated by an additional field(pd_addr) 
> to thread_struct and two system calls(sys_get/set_thread_area()).  __thread 
> keyword is disabled in glibc and nptl. Moreover, some code related TLS in nptl 
> is protected by the glibc macro USE_TLS. 

Thanks for working on this.

I wonder what the performance impact is of having a system call in
THREAD_SELF.  If it turns out to be too great, it may be possible to
reduce the overhead by adding some more support to the kernel.  What
I've been thinking of is a way for applications to supply a pointer to
the kernel (via a new system call), and have it store the current thread
ID at that address during context switch.  That way, retrieving the
thread descriptor would be just a regular memory access.  I think it'd
only add a handful of cycles to the context switch path, and that's a
comparatively heavyweight operation already so it would probably
disappear in the noise.

p.



More information about the Libc-alpha mailing list