Skip to contentSkip to conversation

lib: test module for find_*_bit() functions

PATCH New [email protected] 1 participant 1 message Nov 17, 2017 Library code

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 39/94 lib: test module for find_*_bit() functions

From: Yury Norov <[email protected]>
Subject: 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

[1032111.632383] find_next_bit:		240043 cycles,	164062 iterations
[1032111.647236] find_next_zero_bit:	312848 cycles,	163619 iterations
[1032111.661585] find_last_bit:		193748 cycles,	164062 iterations
[1032113.450517] find_first_bit:	177720874 cycles,	164062 iterations
[1032113.462930]
		 Start testing find_bit() with sparse bitmap
[1032113.477229] find_next_bit:		3633 cycles,	656 iterations
[1032113.494281] find_next_zero_bit:	620399 cycles,	327025 iterations
[1032113.506723] find_last_bit:		3038 cycles,	656 iterations
[1032113.524485] find_first_bit:	691407 cycles,	656 iterations

---

 lib/Kconfig.debug   |    9 ++
 lib/Makefile        |    1 
 lib/test_find_bit.c |  144 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 154 insertions(+)
lib/Kconfig.debug renamed from lib/Kconfig.debug~lib-test-module-for-find__bit-functions +9 -0
diff -puN lib/Kconfig.debug~lib-test-module-for-find__bit-functions lib/Kconfig.debug
@@ -1850,6 +1850,15 @@ config TEST_BPF
 
 	  If unsure, say N.
 
+config TEST_FIND_BIT
+	tristate "Test find_bit functions"
+	default n
+	help
+	  This builds the "test_find_bit" module that measure find_*_bit()
+	  functions performance.
+
+	  If unsure, say N.
+
 config TEST_FIRMWARE
 	tristate "Test firmware loading via userspace interface"
 	default n
lib/Makefile renamed from lib/Makefile~lib-test-module-for-find__bit-functions +1 -0
diff -puN lib/Makefile~lib-test-module-for-find__bit-functions lib/Makefile
@@ -47,6 +47,7 @@ obj-y += hexdump.o
 obj-$(CONFIG_TEST_HEXDUMP) += test_hexdump.o
 obj-y += kstrtox.o
 obj-$(CONFIG_TEST_BPF) += test_bpf.o
+obj-$(CONFIG_TEST_FIND_BIT) += test_find_bit.o
 obj-$(CONFIG_TEST_FIRMWARE) += test_firmware.o
 obj-$(CONFIG_TEST_SYSCTL) += test_sysctl.o
 obj-$(CONFIG_TEST_HASH) += test_hash.o test_siphash.o
lib/test_find_bit.c new file +144 -0

144 lines not on this page · raw message

_