2c86963b09
Back in January 2008 Nick Piggin implemented "ticket" spinlocks
for X86 (See commit 314cdbefd1
).
IA64 implementation has a couple of differences because of the
available atomic operations ... e.g. we have no fetchadd2 instruction
that operates on a 16-bit quantity so we make ticket locks use
a 32-bit word for each of the current ticket and now-serving values.
Performance on uncontended locks is about 8% worse than the previous
implementation, but this seems a good trade for determinism in the
contended case. Performance impact on macro-level benchmarks is in
the noise.
Signed-off-by: Tony Luck <tony.luck@intel.com>
22 lines
433 B
C
22 lines
433 B
C
#ifndef _ASM_IA64_SPINLOCK_TYPES_H
|
|
#define _ASM_IA64_SPINLOCK_TYPES_H
|
|
|
|
#ifndef __LINUX_SPINLOCK_TYPES_H
|
|
# error "please don't include this file directly"
|
|
#endif
|
|
|
|
typedef struct {
|
|
volatile unsigned long lock;
|
|
} raw_spinlock_t;
|
|
|
|
#define __RAW_SPIN_LOCK_UNLOCKED { 0 }
|
|
|
|
typedef struct {
|
|
volatile unsigned int read_counter : 31;
|
|
volatile unsigned int write_lock : 1;
|
|
} raw_rwlock_t;
|
|
|
|
#define __RAW_RW_LOCK_UNLOCKED { 0, 0 }
|
|
|
|
#endif
|