21f8ca3bf6
Use the lockdep infrastructure to track lock contention and other lock statistics. It tracks lock contention events, and the first four unique call-sites that encountered contention. It also measures lock wait-time and hold-time in nanoseconds. The minimum and maximum times are tracked, as well as a total (which together with the number of event can give the avg). All statistics are done per lock class, per write (exclusive state) and per read (shared state). The statistics are collected per-cpu, so that the collection overhead is minimized via having no global cachemisses. This new lock statistics feature is independent of the lock dependency checking traditionally done by lockdep; it just shares the lock tracking code. It is also possible to enable both and runtime disabled either component - thereby avoiding the O(n^2) lock chain walks for instance. This patch: raw_spinlock_t should not use lockdep (and doesn't) since lockdep itself relies on it. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Acked-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
38 lines
720 B
C
38 lines
720 B
C
#ifndef __LINUX_SPINLOCK_TYPES_UP_H
|
|
#define __LINUX_SPINLOCK_TYPES_UP_H
|
|
|
|
#ifndef __LINUX_SPINLOCK_TYPES_H
|
|
# error "please don't include this file directly"
|
|
#endif
|
|
|
|
/*
|
|
* include/linux/spinlock_types_up.h - spinlock type definitions for UP
|
|
*
|
|
* portions Copyright 2005, Red Hat, Inc., Ingo Molnar
|
|
* Released under the General Public License (GPL).
|
|
*/
|
|
|
|
#ifdef CONFIG_DEBUG_SPINLOCK
|
|
|
|
typedef struct {
|
|
volatile unsigned int slock;
|
|
} raw_spinlock_t;
|
|
|
|
#define __RAW_SPIN_LOCK_UNLOCKED { 1 }
|
|
|
|
#else
|
|
|
|
typedef struct { } raw_spinlock_t;
|
|
|
|
#define __RAW_SPIN_LOCK_UNLOCKED { }
|
|
|
|
#endif
|
|
|
|
typedef struct {
|
|
/* no debug version on UP */
|
|
} raw_rwlock_t;
|
|
|
|
#define __RAW_RW_LOCK_UNLOCKED { }
|
|
|
|
#endif /* __LINUX_SPINLOCK_TYPES_UP_H */
|