Re: [RFC PATCH v2 6/6] x86/entry/pti: don't switch PGD on when pti_disable is set

From: Alexey Dobriyan
Date: Thu Jan 11 2018 - 18:12:01 EST


> 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;
}