Re: [RFC][PATCH 5/5] percpu-rwsem: Optimize readers and reduce global impact

From: Oleg Nesterov
Date: Sat May 30 2015 - 16:50:02 EST


On 05/29, Linus Torvalds wrote:
>
> On Fri, May 29, 2015 at 1:09 PM, Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
> >
> > Doesn't it need mb() before "state = readers_slow" to ensure
> > "release" semantics?
>
> Please don't do any mb() at all. Just do smp_store_release() if
> release semantics is what you want.

Agreed!

> (And try to make sure to pair it with smp_load_acquire() on the other
> side for things to make sense)

Hmm. I think you are right...

__percpu_down_read() lacks another mb() after the "state != BLOCK"
check for the same reason, and we can use smp_load_acquire(state)
instead.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/