Re: [PATCH v4 3/3] randomize_kstack: Unify random source across arches

From: David Laight

Date: Mon Feb 23 2026 - 04:45:01 EST


On Sun, 22 Feb 2026 22:34:26 +0100
Thomas Gleixner <tglx@xxxxxxxxxx> wrote:

> On Mon, Jan 19 2026 at 13:01, Ryan Roberts wrote:
> > I tested an earlier version of this change on x86 bare metal and it
> > showed a smaller but still significant improvement. The bare metal
> > system wasn't available this time around so testing was done in a VM
> > instance. I'm guessing the cost of rdtsc is higher for VMs.
>
> No it's not, unless the hypervisor traps RDTSC, which would be insane as
> that would cause massive regressions all over the place.
>
> So guessing is not really helpful if you want to argue performance.

The cost of rdtsc will depend on the cpu architecture.
To get valid comparisons you need to run on identical systems.

Regardless, the cost of rdtsc could easily be larger than the
cost of the prandom_u32_state() code (especially if inlined or
without all the return thunk 'crap').

David

>
> Thanks,
>
> tglx