]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mutex subsystem, synchro-test module
authorDavid Howells <dhowells@redhat.com>
Thu, 31 Dec 2020 22:05:09 +0000 (22:05 +0000)
committerJohannes Weiner <hannes@cmpxchg.org>
Thu, 31 Dec 2020 22:05:09 +0000 (22:05 +0000)
commit4567ec742104ecfa8e3503a359ab112f827fc931
treeb6782819f4cb383b0fe5a7da0694018df0e239fa
parent450345ec8cf0f39957f8af3773f9eaeab36fc022
mutex subsystem, synchro-test module

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".

[randy.dunlap@oracle.com: fix build errors, add <sched.h> header file]
[akpm@linux-foundation.org: remove smp_lock.h inclusion]
[viro@ZenIV.linux.org.uk: kill daemonize() calls]
[rdunlap@xenotime.net: fix printk format warrnings]
[walken@google.com: add spinlock test]
[walken@google.com: document default load and interval values]
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: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Michel Lespinasse <walken@google.com>
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