From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932484AbbCQTB1 (ORCPT ); Tue, 17 Mar 2015 15:01:27 -0400 Received: from mail.efficios.com ([78.47.125.74]:35284 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932172AbbCQTBY (ORCPT ); Tue, 17 Mar 2015 15:01:24 -0400 Date: Tue, 17 Mar 2015 19:01:23 +0000 (UTC) From: Mathieu Desnoyers To: Peter Zijlstra Cc: josh@joshtriplett.org, 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 Message-ID: <1338809369.22714.1426618883816.JavaMail.zimbra@efficios.com> In-Reply-To: <20150317180824.GK23123@twins.programming.kicks-ass.net> References: <1426612922-3308-1-git-send-email-mathieu.desnoyers@efficios.com> <20150317173035.GI23123@twins.programming.kicks-ass.net> <20150317175750.GB4141@cloud> <20150317180824.GK23123@twins.programming.kicks-ass.net> Subject: Re: [RFC PATCH v13] sys_membarrier(): system/process-wide memory barrier (x86) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [173.246.22.116] X-Mailer: Zimbra 8.0.7_GA_6021 (ZimbraWebClient - FF36 (Linux)/8.0.7_GA_6021) Thread-Topic: sys_membarrier(): system/process-wide memory barrier (x86) Thread-Index: DUEsjynlAJeXnaGDkBz/dM7dqPu0fg== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- Original Message ----- > On Tue, Mar 17, 2015 at 10:57:50AM -0700, josh@joshtriplett.org wrote: > > 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. > > Sure; but why bother with pointless fluff like that? We can always > introduce the private flag if and when it starts to make sense having > it. Without the expedited implementation, the only usefulness of the private flag is to skip synchronize_sched() if called from a single-threaded process. We could easily argue that if a process is using sys_membarrier in the first place, it's very likely that it is multithreaded. So I agree that we can drop the flag for now, and add it later on, e.g. when adding the expedited mode. I am tempted to leave the "flags" argument in place though, along with the "MEMBARRIER_QUERY" flag. Thoughts ? Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com