Re: proposed smp_rendezvous change

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Tue, 17 May 2011 23:16:21 +0300
on 17/05/2011 18:51 John Baldwin said the following:
> On Tuesday, May 17, 2011 10:34:41 am Andriy Gapon wrote:
>> on 17/05/2011 16:58 John Baldwin said the following:
>>> No, it doesn't quite work that way.  It wouldn't work on Alpha for example.
>>>
>>> All load_acq is a load with a memory barrier to order other loads after it.
>>> It is still free to load stale data.  Only a read-modify-write operation
>>> would actually block until it could access an up-to-date value.
>>
>> Hmm, ok.
>> How about atomic_add_acq_int(&smp_rv_waiters[0], 0) ? :-)
>> Or an equivalent MI action that doesn't actually change smp_rv_waiters[0] value,
>> if there could be any.
>> Maybe explicit atomic_cmpset_acq_int(&smp_rv_waiters[0], 0, 0) ?
>>
>> You see at what I am getting?
> 
> Yeah, either of those would work.  At this point just leaving the
> atomic_add_int() as-is would be the smallest diff. :)

Yes, I agree about the smallest diff.
But if we are going to remove that first spin-loop, then we would effectively be
wasting one volatile variable.  Only a tiny waste, but it could be confusing.

Whatever we decide, this was very educational for me.
-- 
Andriy Gapon
Received on Tue May 17 2011 - 18:16:25 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:14 UTC