Messages in this thread | | | Date | Wed, 16 Jul 2014 09:40:19 -0500 (CDT) | From | Christoph Lameter <> | Subject | Re: [PATCH RFC] percpu: add data dependency barrier in percpu accessors and operations |
| |
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.
| |