lkml.org 
[lkml]   [2015]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] [PATCH] sched: Add smp_rmb() in task rq locking cycles
On Fri, Feb 20, 2015 at 07:28:16PM +0100, Manfred Spraul wrote:

> >We need the full barrier to serialize STORE's as well, but probably we can
> >rely on control dependancy and thus we only need rmb().
> Do we need a full barrier or not?
>
> I don't manage to create a proper line of reasoning.

I think I agree with Oleg in that we only need the smp_rmb(); of course
that wants a somewhat elaborate comment to go along with it. How about
something like so:

spin_unlock_wait(&local);
/*
* The above spin_unlock_wait() forms a control dependency with
* any following stores; because we must first observe the lock
* unlocked and we cannot speculate stores.
*
* Subsequent loads however can easily pass through the loads
* represented by spin_unlock_wait() and therefore we need the
* read barrier.
*
* This together is stronger than ACQUIRE for @local and
* therefore we will observe the complete prior critical section
* of @local.
*/
smp_rmb();

The obvious alternative is using spin_unlock_wait() with an
smp_load_acquire(), but that might be more expensive on some archs due
to repeated issuing of memory barriers.



\
 
 \ /
  Last update: 2015-02-20 20:01    [W:0.221 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site