lib: test module for find_*_bit() functions
authorYury Norov <[email protected]>
Fri, 17 Nov 2017 23:28:31 +0000 (15:28 -0800)
committerLinus Torvalds <[email protected]>
Sat, 18 Nov 2017 00:10:02 +0000 (16:10 -0800)
commit4441fca0a27f5f0e2c652584ae9d7abec6255c1f
treeba8583bfe222c45b3f34a98f2d633b22ca3530f1
parent0b548e33e6cb2bff240fdaf1783783be15c29080
lib: test module for find_*_bit() functions

find_bit functions are widely used in the kernel, including hot paths.
This module tests performance of those functions in 2 typical scenarios:
randomly filled bitmap with relatively equal distribution of set and
cleared bits, and sparse bitmap which has 1 set bit for 500 cleared
bits.

On ThunderX machine:

 Start testing find_bit() with random-filled bitmap
find_next_bit:          240043 cycles,  164062 iterations
find_next_zero_bit:     312848 cycles,  163619 iterations
find_last_bit:          193748 cycles,  164062 iterations
find_first_bit:      177720874 cycles,  164062 iterations

 Start testing find_bit() with sparse bitmap
find_next_bit:            3633 cycles,     656 iterations
find_next_zero_bit:     620399 cycles,  327025 iterations
find_last_bit:            3038 cycles,     656 iterations
find_first_bit:         691407 cycles,     656 iterations

[[email protected]: use correct format string for find-bit tests]
Link: http://lkml.kernel.org/r/[email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Yury Norov <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Reviewed-by: Clement Courbet <[email protected]>
Cc: Alexey Dobriyan <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Cc: Rasmus Villemoes <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
lib/Kconfig.debug
lib/Makefile
lib/test_find_bit.c [new file with mode: 0644]