This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Unify pthread_spin_[try]lock implementations.


On 8/16/2012 6:20 AM, Torvald Riegel wrote:
>> while Teil will use -1.
> Is there a plan to include a back-off component in this generic spin
> lock?  (-1 would spin forever, but not do back-off.)

Certainly one could imagine parameterizing a back-off loop with starting
point and ending point for a bounded exponential backoff calling
atomic_delay() in the loop (as Roland proposed a while back).  I expect
something like that would be usable for the tile architecture.

But my instinct is that it is too architecture-dependent to try to get this
right enough for all platforms, and the basic idea of a spinlock is simple
enough for each architecture to express that it's probably not a good
tradeoff.  In fact, I'm a little concerned that the proposed spinlock is
overdesigned as it is, with every platform providing the same macro
parameter to conditionalize it such that it looks exactly the same.  I'd
probably rather see a straight-up ARM implementation, and then just write
it such that HPPA, M68K, and MIPS can #include the ARM version if they want
to, rather than trying to make something that seems more complex than
necessary for the truly generic implementation, but not complex enough to
really be usable by every implementation.

But: bike-shedding.  If the maintainers of those platforms are happy,
that's fine with me.  :-)

-- 
Chris Metcalf, Tilera Corp.
http://www.tilera.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]