The attached patch adds a module for testing and benchmarking mutexes,
commit53970fb54d1f2e5532420d94ba73ebacd55044c4
authorDavid Howells <dhowells@redhat.com>
Wed, 14 Oct 2009 02:57:21 +0000 (14 04:57 +0200)
committerjames toy <toyj@union.edu>
Wed, 14 Oct 2009 02:57:21 +0000 (14 04:57 +0200)
tree987836a6031a7315397688e29dea63ad278bd616
parent0e651f3dfc23eaad06d890f6e4e21ea30a7e175b
The attached patch adds a module for testing and benchmarking mutexes,
semaphores and R/W semaphores.

Using it is simple:

insmod synchro-test.ko <args>

It will exit with error ENOANO after running the tests and printing the
results to the kernel console log.

The available arguments are:

 (*) mx=N

Start up to N mutex thrashing threads, where N is at most 20. All will
try and thrash the same mutex.

 (*) sm=N

Start up to N counting semaphore thrashing threads, where N is at most
20. All will try and thrash the same semaphore.

 (*) ism=M

Initialise the counting semaphore with M, where M is any positive
integer greater than zero. The default is 4.

 (*) rd=N
 (*) wr=O
 (*) dg=P

Start up to N reader thrashing threads, O writer thrashing threads and
P downgrader thrashing threads, where N, O and P are at most 20
apiece. All will try and thrash the same read/write semaphore.

 (*) elapse=N

Run the tests for N seconds. The default is 5.

 (*) load=N

Each thread delays for N uS whilst holding the lock. The dfault is 0.

 (*) interval=N

Each thread delays for N uS whilst not holding the lock. The default
is 0.

 (*) do_sched=1

Each thread will call schedule if required after each iteration.

 (*) v=1

Print more verbose information, including a thread iteration
distribution list.

The module should be enabled by turning on CONFIG_DEBUG_SYNCHRO_TEST to "m".

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Documentation/synchro-test.txt [new file with mode: 0644]
kernel/Makefile
kernel/synchro-test.c [new file with mode: 0644]
lib/Kconfig.debug