bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fix for THREAD_GETMEM (et al) madness in useldt.h


From: M.E. O'Neill
Subject: Re: Fix for THREAD_GETMEM (et al) madness in useldt.h
Date: Fri, 24 Nov 2000 21:45:58 -0800

Wolfram Gloger wrote:
> I asked a similar question recently, and Uli Drepper suspected that
> the LDT switching would be very slow on processors before i686.

What aspect of ``LDT switching'' is supposed to be slow?  Changing the
LDT as part of a task switch, loading segment registers, such as GS, or
reading them?  I have the _Intel Architecture Software Developer's
Manual_, and a quick glance didn't show anything to suggest that using
the LDT would be slow.

> I have yet to confirm that -- maybe you can check pthread_self()
> performance in both cases, too, so we have some numbers.

My preliminary tests are a little inconclusive, but don't seem to indicate
any ``dramatic slowdowns'' -- the thread-descriptor code is such a tiny
fraction of the whole that there seems to be no noticeable difference in
practice.  My own programs seem to run at about the same speed regardless
of the mechanism, but, then again, my programs try to tread as lightly
as possible on the pthreads library (on other platforms, pthread_self()
involves a system call!).  [In fact, my code uses work-stealing to
provide fine-grained nested parallelism (millions/billions of ``tasks'')
that runs on top of pthreads.].

As a quick test for problems with the LDT thread-descriptor mechanism,
I wrote a ``meaningless-benchmark program'' that spawns two threads that
both call pthread_self in a tight loop.  That program ran better with
the LDT version of the library (completing in almost half (55%) of the
time).  But a similar program that gave each thread a recursive mutex
to play with as well did better with the non-LDT library (although the
difference in this case was small, about 3%).  I'm at a loss to explain
the inconsistency, but I'm certainly not seeing a major case against
LDT use on the i586.

    M.E.O.

P.S. If anyone has a test program they'd like me to run that stresses
things a little more, let me know.  Similarly, I can post my
meaningless-benchmark program if anyone would like to see it.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]