Re: [PATCH v2 2/2] crypto: xor - use ktime for template benchmarking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Sat, Sep 26, 2020 at 3:27 AM Ard Biesheuvel <ardb@xxxxxxxxxx> wrote:
>
> Currently, we use the jiffies counter as a time source, by staring at
> it until a HZ period elapses, and then staring at it again and perform
> as many XOR operations as we can at the same time until another HZ
> period elapses, so that we can calculate the throughput. This takes
> longer than necessary, and depends on HZ, which is undesirable, since
> HZ is system dependent.
>
> Let's use the ktime interface instead, and use it to time a fixed
> number of XOR operations, which can be done much faster, and makes
> the time spent depend on the performance level of the system itself,
> which is much more reasonable. To ensure that we have the resolution
> we need even on systems with 32 kHz time sources, while not spending too
> much time in the benchmark on a slow CPU, let's switch to 3 attempts of
> 800 repetitions each: that way, we will only misidentify algorithms that
> perform within 10% of each other as the fastest if they are faster than
> 10 GB/s to begin with, which is not expected to occur on systems with
> such coarse clocks.
>
> On ThunderX2, I get the following results:
>
> Before:
>
>   [72625.956765] xor: measuring software checksum speed
>   [72625.993104]    8regs     : 10169.000 MB/sec
>   [72626.033099]    32regs    : 12050.000 MB/sec
>   [72626.073095]    arm64_neon: 11100.000 MB/sec
>   [72626.073097] xor: using function: 32regs (12050.000 MB/sec)
>
> After:
>
>   [72599.650216] xor: measuring software checksum speed
>   [72599.651188]    8regs           : 10491 MB/sec
>   [72599.652006]    32regs          : 12345 MB/sec
>   [72599.652871]    arm64_neon      : 11402 MB/sec
>   [72599.652873] xor: using function: 32regs (12345 MB/sec)

What are the chances of 12345 coming up?  ;-)

>
> Link: https://lore.kernel.org/linux-crypto/20200923182230.22715-3-ardb@xxxxxxxxxx/
> Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx>
> ---
>  crypto/xor.c | 38 +++++++++-----------
>  1 file changed, 16 insertions(+), 22 deletions(-)

This looks good to me.  Thanks for taking this on!

Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx>



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux