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.


> Some work we did a while back found that bounded exponential delay tended
> to work best for any kind of spinlock.  So if we fail to acquire the lock
> the first time around, we wait a few cycles and try again, then keep
> doubling the wait time up to some ceiling (around 1000 cycles or so); see
> ports/sysdeps/tile/nptl/pthread_spin_lock.c.

I see.  Some sort of exponential backoff like that is probably a good idea
generally.  But in generic code it certainly wouldn't be one that's based
on taking cycle counter samples.  It would have to be just counting
iterations of calling atomic_delay.


Thanks,
Roland


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