From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933246AbcBYREk (ORCPT ); Thu, 25 Feb 2016 12:04:40 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:59944 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753461AbcBYREi (ORCPT ); Thu, 25 Feb 2016 12:04:38 -0500 Date: Thu, 25 Feb 2016 18:04:16 +0100 From: Peter Zijlstra To: Mathieu Desnoyers Cc: Andrew Morton , Russell King , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , linux-kernel@vger.kernel.org, linux-api , Paul Turner , Andrew Hunter , Andy Lutomirski , Andi Kleen , Dave Watson , Chris Lameter , Ben Maurer , rostedt , "Paul E. McKenney" , Josh Triplett , Linus Torvalds , Catalin Marinas , Will Deacon , Michael Kerrisk Subject: Re: [PATCH v4 1/5] getcpu_cache system call: cache CPU number of running thread Message-ID: <20160225170416.GV6356@twins.programming.kicks-ass.net> References: <1456270120-7560-1-git-send-email-mathieu.desnoyers@efficios.com> <1456270120-7560-2-git-send-email-mathieu.desnoyers@efficios.com> <20160225095635.GO6356@twins.programming.kicks-ass.net> <390571988.7745.1456419326288.JavaMail.zimbra@efficios.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <390571988.7745.1456419326288.JavaMail.zimbra@efficios.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 25, 2016 at 04:55:26PM +0000, Mathieu Desnoyers wrote: > ----- On Feb 25, 2016, at 4:56 AM, Peter Zijlstra peterz@infradead.org wrote: > The restartable sequences are intrinsically designed to work > on per-cpu data, so they need to fetch the current CPU number > within the rseq critical section. This is where the getcpu_cache > system call becomes very useful when combined with rseq: > getcpu_cache allows reading the current CPU number in a > fraction of cycle. Yes yes, I know how restartable sequences work. But what I worry about is that they want a cpu number and a sequence number, and for performance it would be very good if those live in the same cacheline. That means either getcpu needs to grow a seq number, or restartable sequences need to _also_ provide the cpu number.