Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751541AbbLMIFo (ORCPT ); Sun, 13 Dec 2015 03:05:44 -0500 Received: from mail-wm0-f44.google.com ([74.125.82.44]:37340 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750903AbbLMIFG (ORCPT ); Sun, 13 Dec 2015 03:05:06 -0500 MIME-Version: 1.0 Reply-To: mtk.manpages@gmail.com In-Reply-To: <1734518724.233994.1449924035932.JavaMail.zimbra@efficios.com> References: <1449761990-23525-1-git-send-email-mathieu.desnoyers@efficios.com> <566B1C6A.4030603@gmail.com> <1734518724.233994.1449924035932.JavaMail.zimbra@efficios.com> From: "Michael Kerrisk (man-pages)" Date: Sun, 13 Dec 2015 09:04:45 +0100 Message-ID: Subject: Re: [RFC PATCH 1/2] thread_local_abi system call: caching current CPU number (x86) To: Mathieu Desnoyers Cc: Thomas Gleixner , lkml , Paul Turner , Andrew Hunter , Peter Zijlstra , Andy Lutomirski , Andi Kleen , Dave Watson , Chris Lameter , Ingo Molnar , Ben Maurer , rostedt , "Paul E. McKenney" , Josh Triplett , Linus Torvalds , Andrew Morton , linux-api Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2058 Lines: 55 Hello Mathieu On 12 December 2015 at 13:40, Mathieu Desnoyers wrote: > ----- On Dec 11, 2015, at 1:56 PM, Michael Kerrisk mtk.manpages@gmail.com wrote: > >> Hi Mathieu, >> >> On 12/10/2015 04:39 PM, Mathieu Desnoyers wrote: >>> Expose a new system call allowing threads to register a userspace memory >>> area where to store the current CPU number. Scheduler migration sets the >>> TIF_NOTIFY_RESUME flag on the current thread. Upon return to user-space, >>> a notify-resume handler updates the current CPU value within that >>> user-space memory area. >>> >>> This getcpu cache is an alternative to the sched_getcpu() vdso which has >>> a few benefits: >>> - It is faster to do a memory read that to call a vDSO, >>> - This cached value can be read from within an inline assembly, which >>> makes it a useful building block for restartable sequences. >>> >>> This approach is inspired by Paul Turner and Andrew Hunter's work >>> on percpu atomics, which lets the kernel handle restart of critical >>> sections: >>> Ref.: >>> * https://lkml.org/lkml/2015/6/24/665 >>> * https://lwn.net/Articles/650333/ >>> * >>> http://www.linuxplumbersconf.org/2013/ocw/system/presentations/1695/original/LPC%20-%20PerCpu%20Atomics.pdf >>> >>> Benchmarking sched_getcpu() vs tls cache approach. Getting the >>> current CPU number: >> >> Is there a man page for this system call? > > Hi Michael, > > Not yet. I first want check whether the overall technical > approach is deemed acceptable before adding documentation. > > Adding a manpage is going to be one of the first steps after > we agree on the syscall interface. Or perhaps you are suggesting > that adding a manpage at this RFC stage could help the > interface discussion ? Yup, that's exactly what I'm suggesting. Thanks, Michael -- 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/