From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753939AbcAEHCX (ORCPT ); Tue, 5 Jan 2016 02:02:23 -0500 Received: from mail.efficios.com ([78.47.125.74]:59582 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750787AbcAEHCU convert rfc822-to-8bit (ORCPT ); Tue, 5 Jan 2016 02:02:20 -0500 From: Mathieu Desnoyers To: Thomas Gleixner , Paul Turner , Andrew Hunter , Peter Zijlstra Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Andy Lutomirski , Andi Kleen , Dave Watson , Chris Lameter , Ingo Molnar , Ben Maurer , Steven Rostedt , "Paul E. McKenney" , Josh Triplett , Linus Torvalds , Andrew Morton , Russell King , Catalin Marinas , Will Deacon , Michael Kerrisk , Mathieu Desnoyers Subject: [RFC PATCH 0/3] Implement getcpu_cache system call Date: Tue, 5 Jan 2016 02:01:57 -0500 Message-Id: <1451977320-4886-1-git-send-email-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Here is a patchset implementing a cache for the CPU number of the currently running thread in user-space. Benchmarks comparing this approach to a system call-based getcpu on ARM show a 44x speedup. They show a 14x speedup on x86-64 compared to executing lsl from a vDSO through glibc. I'm added a man page in the changelog of patch 1/3, which shows an example usage of this new system call. This patchset is sent as RFC. It applies on Linux 4.3. Feedback is welcome, Thanks! Mathieu Mathieu Desnoyers (3): getcpu_cache system call: cache CPU number of running thread getcpu_cache: wire up ARM system call getcpu_cache: wire up x86 32/64 system call arch/arm/include/uapi/asm/unistd.h | 1 + arch/arm/kernel/calls.S | 1 + arch/arm/kernel/signal.c | 1 + arch/x86/entry/common.c | 1 + arch/x86/entry/syscalls/syscall_32.tbl | 1 + arch/x86/entry/syscalls/syscall_64.tbl | 1 + fs/exec.c | 1 + include/linux/init_task.h | 8 ++ include/linux/sched.h | 43 +++++++++ include/uapi/linux/Kbuild | 1 + include/uapi/linux/getcpu_cache.h | 44 +++++++++ init/Kconfig | 10 ++ kernel/Makefile | 1 + kernel/fork.c | 7 ++ kernel/getcpu_cache.c | 170 +++++++++++++++++++++++++++++++++ kernel/sched/core.c | 3 + kernel/sched/sched.h | 1 + kernel/sys_ni.c | 3 + 18 files changed, 298 insertions(+) create mode 100644 include/uapi/linux/getcpu_cache.h create mode 100644 kernel/getcpu_cache.c -- 2.1.4 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mathieu Desnoyers Subject: [RFC PATCH 0/3] Implement getcpu_cache system call Date: Tue, 5 Jan 2016 02:01:57 -0500 Message-ID: <1451977320-4886-1-git-send-email-mathieu.desnoyers@efficios.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Return-path: Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Thomas Gleixner , Paul Turner , Andrew Hunter , Peter Zijlstra Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Andy Lutomirski , Andi Kleen , Dave Watson , Chris Lameter , Ingo Molnar , Ben Maurer , Steven Rostedt , "Paul E. McKenney" , Josh Triplett , Linus Torvalds , Andrew Morton , Russell King , Catalin Marinas , Will Deacon , Michael Kerrisk , Mathieu Desnoyers List-Id: linux-api@vger.kernel.org Hi, Here is a patchset implementing a cache for the CPU number of the currently running thread in user-space. Benchmarks comparing this approach to a system call-based getcpu on ARM show a 44x speedup. They show a 14x speedup on x86-64 compared to executing lsl from a vDSO through glibc. I'm added a man page in the changelog of patch 1/3, which shows an example usage of this new system call. This patchset is sent as RFC. It applies on Linux 4.3. Feedback is welcome, Thanks! Mathieu Mathieu Desnoyers (3): getcpu_cache system call: cache CPU number of running thread getcpu_cache: wire up ARM system call getcpu_cache: wire up x86 32/64 system call arch/arm/include/uapi/asm/unistd.h | 1 + arch/arm/kernel/calls.S | 1 + arch/arm/kernel/signal.c | 1 + arch/x86/entry/common.c | 1 + arch/x86/entry/syscalls/syscall_32.tbl | 1 + arch/x86/entry/syscalls/syscall_64.tbl | 1 + fs/exec.c | 1 + include/linux/init_task.h | 8 ++ include/linux/sched.h | 43 +++++++++ include/uapi/linux/Kbuild | 1 + include/uapi/linux/getcpu_cache.h | 44 +++++++++ init/Kconfig | 10 ++ kernel/Makefile | 1 + kernel/fork.c | 7 ++ kernel/getcpu_cache.c | 170 +++++++++++++++++++++++++++++++++ kernel/sched/core.c | 3 + kernel/sched/sched.h | 1 + kernel/sys_ni.c | 3 + 18 files changed, 298 insertions(+) create mode 100644 include/uapi/linux/getcpu_cache.h create mode 100644 kernel/getcpu_cache.c -- 2.1.4