Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jul 2011 14:39:00 +0300
From:      Andriy Gapon <avg@FreeBSD.org>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        Max Laier <max@love2party.net>, FreeBSD current <freebsd-current@FreeBSD.org>
Subject:   Re: proposed smp_rendezvous change
Message-ID:  <4E241B54.8080207@FreeBSD.org>
In-Reply-To: <201105171151.18038.jhb@freebsd.org>
References:  <4DCD357D.6000109@FreeBSD.org> <201105170958.16847.jhb@freebsd.org> <4DD28781.6050002@FreeBSD.org> <201105171151.18038.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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, atomic_add_int() for smp_rv_waiters[0] is completely OK, it's the spinwait
loop on it that is a bit wasteful.  And probably the extra smp_rv_waiters[]
element used only for this purpose.  Do you agree?

Convenience link to the gmane archive of this thread:
http://article.gmane.org/gmane.os.freebsd.current/132730
-- 
Andriy Gapon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4E241B54.8080207>