Re: [PATCH RFC] percpu: add data dependency barrier in percpu accessors and operations

From: Christoph Lameter
Date: Wed Jul 16 2014 - 10:40:29 EST


On Tue, 15 Jul 2014, Paul E. McKenney wrote:

> Sorry, but whether you see it or not, there is a very real need for at
> least an smp_wmb() from the initializing code and at least an
> smp_read_barrier_depends() from the reading code.

Nope this is the wrong approach. Adding synchronization to basic
primitives that are designed to be as fast as possible is not good. Even
if it does nothing it tends to bloat over time and get the wrong ideas in
peoples heads.

Fixing this is possible by making sure that the remote cachelines are
evicted on alloc_percpu. alloc_percpu should not be allowed to return
until it has made sure that the remote cachelines all have been evicted.
On some weak ordered platforms that may require special instructions or
even an IPI to move the initilization done by alloc_percpu to the remote
cpu.

--
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/