Re: [PATCH] x86/vdso: Use non-serializing instruction rdtsc

From: H. Peter Anvin
Date: Tue May 16 2023 - 13:58:17 EST


On May 16, 2023 7:12:34 AM PDT, Dave Hansen <dave.hansen@xxxxxxxxx> wrote:
>On 5/15/23 23:52, Rong Tao wrote:
>> Replacing rdtscp or 'lfence;rdtsc' with the non-serializable instruction
>> rdtsc can achieve a 40% performance improvement with only a small loss of
>> precision.
>
>I think the minimum that can be done in a changelog like this is to
>figure out _why_ a RDTSCP was in use. There are a ton of things that
>can make the kernel go faster, but not all of them are a good idea.
>
>I assume that the folks that wrote this had good reason for not using
>plain RSTSC. What were those reasons?

I believe the motivation is that it is atomic with reading the CPU number.