From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965040AbaGPOkY (ORCPT ); Wed, 16 Jul 2014 10:40:24 -0400 Received: from qmta07.emeryville.ca.mail.comcast.net ([76.96.30.64]:46376 "EHLO qmta07.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932951AbaGPOkW (ORCPT ); Wed, 16 Jul 2014 10:40:22 -0400 Date: Wed, 16 Jul 2014 09:40:19 -0500 (CDT) From: Christoph Lameter To: "Paul E. McKenney" cc: Rusty Russell , Tejun Heo , David Howells , Linus Torvalds , Andrew Morton , Oleg Nesterov , linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC] percpu: add data dependency barrier in percpu accessors and operations In-Reply-To: <20140715174136.GG8690@linux.vnet.ibm.com> Message-ID: References: <20140612155227.GB23606@htj.dyndns.org> <20140617144151.GD4669@linux.vnet.ibm.com> <20140617152752.GC31819@htj.dyndns.org> <87lhs35p0v.fsf@rustcorp.com.au> <20140714113911.GM16041@linux.vnet.ibm.com> <20140715101150.GA8690@linux.vnet.ibm.com> <20140715143225.GC8690@linux.vnet.ibm.com> <20140715174136.GG8690@linux.vnet.ibm.com> Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.