From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753518AbbCQR55 (ORCPT ); Tue, 17 Mar 2015 13:57:57 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:45849 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752062AbbCQR54 (ORCPT ); Tue, 17 Mar 2015 13:57:56 -0400 Date: Tue, 17 Mar 2015 10:57:50 -0700 From: josh@joshtriplett.org To: Peter Zijlstra Cc: Mathieu Desnoyers , linux-kernel@vger.kernel.org, "Paul E. McKenney" , KOSAKI Motohiro , Steven Rostedt , Nicholas Miell , Linus Torvalds , Ingo Molnar , Alan Cox , Lai Jiangshan , Stephen Hemminger , Andrew Morton , Thomas Gleixner , David Howells Subject: Re: [RFC PATCH v13] sys_membarrier(): system/process-wide memory barrier (x86) Message-ID: <20150317175750.GB4141@cloud> References: <1426612922-3308-1-git-send-email-mathieu.desnoyers@efficios.com> <20150317173035.GI23123@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150317173035.GI23123@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 17, 2015 at 06:30:35PM +0100, Peter Zijlstra wrote: > On Tue, Mar 17, 2015 at 01:22:02PM -0400, Mathieu Desnoyers wrote: > > Here is an implementation of a new system call, sys_membarrier(), which > > executes a memory barrier on either all running threads of the current > > process (MEMBARRIER_PRIVATE) issues a memory barrier on all threads > > running on the system (~MEMBARRIER_PRIVATE). Both are currently > > implemented by calling synchronize_sched(). > > Then why bother with the flag? Semantically, MEMBARRIER_PRIVATE is allowed to avoid issuing a barrier on CPUs not running the current process if it can, while ~MEMBARRIER_PRIVATE may not. (The latter would be useful for applications such as system-wide tracing.) That they're currently both implemented the same way doesn't mean they're semantically equivalent. - Josh Triplett