lkml.org 
[lkml]   [2012]   [Oct]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] percpu-rw-semaphores: use light/heavy barriers
On Tue, Oct 23, 2012 at 08:41:23PM +0200, Oleg Nesterov wrote:
> On 10/23, Paul E. McKenney wrote:
> >
> > * Note that this guarantee implies a further memory-ordering guarantee.
> > * On systems with more than one CPU, when synchronize_sched() returns,
> > * each CPU is guaranteed to have executed a full memory barrier since
> > * the end of its last RCU read-side critical section
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Ah wait... I misread this comment.

And I miswrote it. It should say "since the end of its last RCU-sched
read-side critical section." So, for example, RCU-sched need not force
a CPU that is idle, offline, or (eventually) executing in user mode to
execute a memory barrier. Fixed this.

> But this patch needs more? Or I misunderstood. There is no RCU unlock
> in percpu_up_read().
>
> IOW. Suppose the code does
>
> percpu_down_read();
> x = PROTECTED_BY_THIS_RW_SEM;
> percpu_up_read();
>
> Withoit mb() the load above can be reordered with this_cpu_dec() in
> percpu_up_read().
>
> However, we do not care if we can guarantee that the next
> percpu_down_write() can not return (iow, the next "write" section can
> not start) until this load is complete.
>
> And I _think_ that another synchronize_sched() in percpu_down_write()
> added by this patch should work.
>
> But, "since the end of its last RCU read-side critical section"
> does not look enough.
>
> Or I misundersood you/Mikulas/both ?

I clearly need to look more carefully at Mikulas's code...

Thanx, Paul



\
 
 \ /
  Last update: 2012-10-27 21:21    [W:0.332 / U:0.652 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site