Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966132AbbDWAku (ORCPT ); Wed, 22 Apr 2015 20:40:50 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:33185 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933119AbbDWAkt (ORCPT ); Wed, 22 Apr 2015 20:40:49 -0400 Date: Wed, 22 Apr 2015 17:40:51 -0700 From: Stephen Hemminger To: Pranith Kumar Cc: Mathieu Desnoyers , LKML , Josh Triplett , KOSAKI Motohiro , Steven Rostedt , Nicholas Miell , Linus Torvalds , Ingo Molnar , Alan Cox , Lai Jiangshan , Andrew Morton , Thomas Gleixner , Peter Zijlstra , David Howells , Michael Kerrisk Subject: Re: [PATCH v16] sys_membarrier(): system-wide memory barrier (generic, x86) Message-ID: <20150422174051.5c868437@urahara> In-Reply-To: References: <1429283202-6245-1-git-send-email-mathieu.desnoyers@efficios.com> <1526056761.34535.1429735242508.JavaMail.zimbra@efficios.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1488 Lines: 33 On Wed, 22 Apr 2015 20:37:08 -0400 Pranith Kumar wrote: > >> I understand why this syscall makes sense on SMP only, but you are > >> anyways checking num_online_cpus() and returning if it is only one. Is > >> this limitation necessary then? How do !SMP systems handle this > >> syscall? (I am guessing glibc wrapper?) > > > > For !SMP, this system call is not implemented (returns -ENOSYS). > > Userspace libs are expected to query sysconf(_SC_NPROCESSORS_CONF) > > and check whether the system supports multiprocessor at all. If > > only a single processor is supported by the kernel, then userspace > > can skip the calls to sys_membarrier altogether, because they are > > not even needed. > > > > Do you think this kind of information belongs in a man page ? > > > > Should we instead just implement the system call in !SMP, and > > return 0 without any side-effect ? This would be a bit inefficient > > to let userspace call a system call that has no effect whatsoever. > > > > Are there any other SMP-only system calls like this? I am not really > sure what is the right way but documenting it would be good. The syscall should just return 0. Let the application not worry about how many CPU's are present -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/