This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
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