Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752326AbbLMSPc (ORCPT ); Sun, 13 Dec 2015 13:15:32 -0500 Received: from one.firstfloor.org ([193.170.194.197]:59820 "EHLO one.firstfloor.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752276AbbLMSPa (ORCPT ); Sun, 13 Dec 2015 13:15:30 -0500 Date: Sun, 13 Dec 2015 19:15:27 +0100 From: Andi Kleen To: Mathieu Desnoyers Cc: Thomas Gleixner , linux-kernel@vger.kernel.org, Paul Turner , Andrew Hunter , Peter Zijlstra , Andy Lutomirski , Andi Kleen , Dave Watson , Chris Lameter , Ingo Molnar , Ben Maurer , Steven Rostedt , "Paul E. McKenney" , Josh Triplett , Linus Torvalds , Andrew Morton , linux-api@vger.kernel.org Subject: Re: [RFC PATCH 1/2] thread_local_abi system call: caching current CPU number (x86) Message-ID: <20151213181527.GV15533@two.firstfloor.org> References: <1449761990-23525-1-git-send-email-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1449761990-23525-1-git-send-email-mathieu.desnoyers@efficios.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1024 Lines: 26 > This getcpu cache is an alternative to the sched_getcpu() vdso which has > a few benefits: Note the first version of getcpu() I proposed had a cache. But it was rejected. > - 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. On x86 we already have the de-facto ABI of using LSL with the magic segment directly. While that is a few cycles slower than a memory load I question the difference is big enough to justify a new system call, and risk slow page fault in context switches. BTW the vdso could be also optimized I think. For example glibc today does some stupid (slow) things with it, like doing double iindirect jumps. -Andi -- 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/