The lockdep of Chapter 11 proves that locks are used correctly: the lock ordering is acyclic and acquisitions and releases are properly paired. But there is a more fundamental question: is the lock implementation itself correct? Does a newly written spinlock or mutex really guarantee mutual exclusion, never lose a wakeup, and never wait forever under arbitrary concurrency? Such guarantees cannot be established exhaustively by reading code; they can only be forced out with intense concurrency. locktorture is the stress-testing framework the kernel provides for exactly this, echoing the approach of Chapter 7, where ww_mutex is validated by injecting deadlocks with test-ww_mutex.
This chapter is anchored on kernel/locking/locktorture.c. It is a kernel module built on the kernel’s generic torture-test framework (sharing the same infrastructure as rcutorture), and it starts running as soon as it is loaded.
Note: locktorture is a test facility. Module parameters select the lock type under test and the number of threads, and it plays no part in production paths.