Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932187AbeAKXL5 (ORCPT + 1 other); Thu, 11 Jan 2018 18:11:57 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:41877 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754072AbeAKXLz (ORCPT ); Thu, 11 Jan 2018 18:11:55 -0500 X-Google-Smtp-Source: ACJfBotJU2gqV78uIcvDlzmq6iNWhaw1k97c8DPxW8zI/qY0IMy4IBOAoNj9o9yvN8I2pIirWBO8GA== Date: Fri, 12 Jan 2018 02:11:51 +0300 From: Alexey Dobriyan To: w@1wt.eu Cc: linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v2 6/6] x86/entry/pti: don't switch PGD on when pti_disable is set Message-ID: <20180111231151.GA12706@avx2> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: > I initially tried getpid() which I found to be cached by glibc, but I > switched to write(-1, "a", 1) in the example in the cover letter and > the test for 3 million runs roughly climbs from 200 ms to 900 ms under > kvm (with PCID this time, I didn't retest without). umask() is the fastest system call I think. Also who cares about glibc caching? static inline int sys_umask(int mask) { int rv; asm volatile ( "syscall" : "=a" (rv) : "0" (95), "D" (mask) : "rcx", "r11", "cc", "memory" ); return rv; } int main(void) { unsigned int i; for (i = 0; i < (1U << 24); i++) { sys_umask(0); } return 0; }