Skip to content

Commit 653ed64

Browse files
joelagnelpaulmckrcu
authored andcommitted
refperf: Add a test to measure performance of read-side synchronization
Add a test for comparing the performance of RCU with various read-side synchronization mechanisms. The test has proved useful for collecting data and performing these comparisons. Currently RCU, SRCU, reader-writer lock, reader-writer semaphore and reference counting can be measured using refperf.perf_type parameter. Each invocation of the test runs measures performance of a specific mechanism. The maximum number of CPUs to concurrently run readers on is chosen by the test itself and is 75% of the total number of CPUs. So if you had 24 CPUs, the test runs with a maximum of 18 parallel readers. A number of experiments are conducted, and in each experiment, the number of readers is increased by 1, upto the 75% of CPUs mark. During each experiment, all readers execute an empty loop with refperf.loops iterations and time the total loop duration. This is then averaged. Example output: Parameters "refperf.perf_type=srcu refperf.loops=2000000" looks like: [ 3.347133] srcu-ref-perf: [ 3.347133] Threads Time(ns) [ 3.347133] 1 36 [ 3.347133] 2 34 [ 3.347133] 3 34 [ 3.347133] 4 34 [ 3.347133] 5 33 [ 3.347133] 6 33 [ 3.347133] 7 33 [ 3.347133] 8 33 [ 3.347133] 9 33 [ 3.347133] 10 33 [ 3.347133] 11 33 [ 3.347133] 12 33 [ 3.347133] 13 33 [ 3.347133] 14 33 [ 3.347133] 15 32 [ 3.347133] 16 33 [ 3.347133] 17 33 [ 3.347133] 18 34 Signed-off-by: Joel Fernandes (Google) <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 7e86646 commit 653ed64

File tree

3 files changed

+578
-0
lines changed

3 files changed

+578
-0
lines changed

kernel/rcu/Kconfig.debug

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,25 @@ config RCU_TORTURE_TEST
6161
Say M if you want the RCU torture tests to build as a module.
6262
Say N if you are unsure.
6363

64+
config RCU_REF_PERF_TEST
65+
tristate "Performance tests for read-side synchronization (RCU and others)"
66+
depends on DEBUG_KERNEL
67+
select TORTURE_TEST
68+
select SRCU
69+
select TASKS_RCU
70+
select TASKS_RUDE_RCU
71+
select TASKS_TRACE_RCU
72+
default n
73+
help
74+
This option provides a kernel module that runs performance tests
75+
useful comparing RCU with various read-side synchronization mechanisms.
76+
The kernel module may be built after the fact on the running kernel to be
77+
tested, if desired.
78+
79+
Say Y here if you want these performance tests built into the kernel.
80+
Say M if you want to build it as a module instead.
81+
Say N if you are unsure.
82+
6483
config RCU_CPU_STALL_TIMEOUT
6584
int "RCU CPU stall timeout in seconds"
6685
depends on RCU_STALL_COMMON

kernel/rcu/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ obj-$(CONFIG_TREE_SRCU) += srcutree.o
1212
obj-$(CONFIG_TINY_SRCU) += srcutiny.o
1313
obj-$(CONFIG_RCU_TORTURE_TEST) += rcutorture.o
1414
obj-$(CONFIG_RCU_PERF_TEST) += rcuperf.o
15+
obj-$(CONFIG_RCU_REF_PERF_TEST) += refperf.o
1516
obj-$(CONFIG_TREE_RCU) += tree.o
1617
obj-$(CONFIG_TINY_RCU) += tiny.o
1718
obj-$(CONFIG_RCU_NEED_SEGCBLIST) += rcu_segcblist.o

0 commit comments

Comments
 (0)