Re: [PATCH] sched: Optimize __calc_delta.

From: Peter Zijlstra
Date: Fri Feb 26 2021 - 16:04:09 EST


On Fri, Feb 26, 2021 at 11:52:39AM -0800, Josh Don wrote:
> From: Clement Courbet <courbet@xxxxxxxxxx>
>
> A significant portion of __calc_delta time is spent in the loop
> shifting a u64 by 32 bits. Use a __builtin_clz instead of iterating.
>
> This is ~7x faster on benchmarks.

Have you tried on hardware without such fancy instructions?