Re: + bitops-optimize-fns-for-improved-performance.patch added to mm-nonmm-unstable branch

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

 



+ Rasmus

On Sat, Apr 27, 2024 at 01:33:55PM +0800, Kuan-Wei Chiu wrote:
> Before:
>                Start testing find_bit() with random-filled bitmap
> [    0.299085] fbcon: Taking over console
> [    0.299820] find_next_bit:                  606286 ns, 164169 iterations
> [    0.300463] find_next_zero_bit:             641072 ns, 163512 iterations
> [    0.300996] find_last_bit:                  531027 ns, 164169 iterations
> [    0.305233] find_nth_bit:                  4235859 ns,  16454 iterations
> [    0.306434] find_first_bit:                1199357 ns,  16455 iterations
> [    0.321616] find_first_and_bit:           15179667 ns,  32869 iterations
> [    0.321917] find_next_and_bit:              298836 ns,  73875 iterations
> [    0.321918] 
>                Start testing find_bit() with sparse bitmap
> [    0.321953] find_next_bit:                    7931 ns,    656 iterations
> [    0.323201] find_next_zero_bit:            1246980 ns, 327025 iterations
> [    0.323210] find_last_bit:                    8000 ns,    656 iterations
> [    0.324427] find_nth_bit:                  1213161 ns,    655 iterations
> [    0.324813] find_first_bit:                 384747 ns,    656 iterations
> [    0.324817] find_first_and_bit:               2220 ns,      1 iterations
> [    0.324820] find_next_and_bit:                1831 ns,      1 iterations
> 
> After:
>                Start testing find_bit() with random-filled bitmap
> [    0.305081] fbcon: Taking over console
> [    0.306126] find_next_bit:                  854517 ns, 163960 iterations
> [    0.307041] find_next_zero_bit:             911725 ns, 163721 iterations
> [    0.307711] find_last_bit:                  668261 ns, 163960 iterations
> [    0.311160] find_nth_bit:                  3447530 ns,  16372 iterations
> [    0.312358] find_first_bit:                1196633 ns,  16373 iterations
> [    0.327191] find_first_and_bit:           14830129 ns,  32951 iterations
> [    0.327503] find_next_and_bit:              310560 ns,  73719 iterations
> [    0.327504] 
>                Start testing find_bit() with sparse bitmap
> [    0.327539] find_next_bit:                    7633 ns,    656 iterations
> [    0.328787] find_next_zero_bit:            1247398 ns, 327025 iterations
> [    0.328797] find_last_bit:                    8425 ns,    656 iterations
> [    0.330034] find_nth_bit:                  1234044 ns,    655 iterations
> [    0.330428] find_first_bit:                 392086 ns,    656 iterations
> [    0.330431] find_first_and_bit:               1980 ns,      1 iterations
> [    0.330434] find_next_and_bit:                1831 ns,      1 iterations
> 
> Some benchmarks seem to have worsened after applying this patch.
> However, unless I'm mistaken, the fns() changes should only affect the
> results of find_nth_bit, while the others are just random fluctuations.

So...

The patch itself looks good, and indeed it should not affect
anything except find_nth_bit(). But -40% for find_next_bit()
and find_next_zero_bit(), and -25% for find_last_bit() don't
look like a fluctuation by any measure.

Looking at the numbers, I can only guess that your testing machine
isn't trustworthy, which means that +18% for find_nth_bit() is not
trustworthy as well. Maybe it's a sort of virtualized environment?

Can you share more about your hardware? Can you make sure it's a bare
metal machine and run your test compiled in the kernel? That way it
will run at boot time, at least before any possible userspace payload.
Can you also run test_bitmap? It has some functional testing for the
function?

> Should I include the above benchmark data in the commit message and
> send a v2 patch?

Yes, I'd like to do so. Because the current benchmark numbers look so
weird, can you run it again? Maybe several times before and after, to
estimate the scatter. Also please run the test_bitmap to check
functional correctness.

Since you already have a code testing the performance of fns(), can
you add it in lib/find_bit_benchmark or lib/test_bitops in a following
patch?

Thanks,
Yury
 
> Additionally, I apologize for you not receiving the email. I received
> the following "Message not delivered" email, but I'm unsure if it's
> related and what caused the error:




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux