diff options
| -rw-r--r-- | include/linux/osq_lock.h | 8 | ||||
| -rw-r--r-- | include/linux/rwsem.h | 2 | ||||
| -rw-r--r-- | kernel/locking/mutex.c | 2 | ||||
| -rw-r--r-- | kernel/locking/rwsem-xadd.c | 2 |
4 files changed, 11 insertions, 3 deletions
diff --git a/include/linux/osq_lock.h b/include/linux/osq_lock.h index b001682bf7cb..90230d5811c5 100644 --- a/include/linux/osq_lock.h +++ b/include/linux/osq_lock.h | |||
| @@ -16,4 +16,12 @@ struct optimistic_spin_queue { | |||
| 16 | atomic_t tail; | 16 | atomic_t tail; |
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | /* Init macro and function. */ | ||
| 20 | #define OSQ_LOCK_UNLOCKED { ATOMIC_INIT(OSQ_UNLOCKED_VAL) } | ||
| 21 | |||
| 22 | static inline void osq_lock_init(struct optimistic_spin_queue *lock) | ||
| 23 | { | ||
| 24 | atomic_set(&lock->tail, OSQ_UNLOCKED_VAL); | ||
| 25 | } | ||
| 26 | |||
| 19 | #endif | 27 | #endif |
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h index 9fdcdd03507d..25cd9aa2f3d7 100644 --- a/include/linux/rwsem.h +++ b/include/linux/rwsem.h | |||
| @@ -69,7 +69,7 @@ static inline int rwsem_is_locked(struct rw_semaphore *sem) | |||
| 69 | __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock), \ | 69 | __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock), \ |
| 70 | LIST_HEAD_INIT((name).wait_list), \ | 70 | LIST_HEAD_INIT((name).wait_list), \ |
| 71 | NULL, /* owner */ \ | 71 | NULL, /* owner */ \ |
| 72 | { ATOMIC_INIT(OSQ_UNLOCKED_VAL) } /* osq */ \ | 72 | OSQ_LOCK_UNLOCKED /* osq */ \ |
| 73 | __RWSEM_DEP_MAP_INIT(name) } | 73 | __RWSEM_DEP_MAP_INIT(name) } |
| 74 | #else | 74 | #else |
| 75 | #define __RWSEM_INITIALIZER(name) \ | 75 | #define __RWSEM_INITIALIZER(name) \ |
diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c index d9b313906caa..acca2c1a3c5e 100644 --- a/kernel/locking/mutex.c +++ b/kernel/locking/mutex.c | |||
| @@ -60,7 +60,7 @@ __mutex_init(struct mutex *lock, const char *name, struct lock_class_key *key) | |||
| 60 | INIT_LIST_HEAD(&lock->wait_list); | 60 | INIT_LIST_HEAD(&lock->wait_list); |
| 61 | mutex_clear_owner(lock); | 61 | mutex_clear_owner(lock); |
| 62 | #ifdef CONFIG_MUTEX_SPIN_ON_OWNER | 62 | #ifdef CONFIG_MUTEX_SPIN_ON_OWNER |
| 63 | atomic_set(&lock->osq.tail, OSQ_UNLOCKED_VAL); | 63 | osq_lock_init(&lock->osq); |
| 64 | #endif | 64 | #endif |
| 65 | 65 | ||
| 66 | debug_mutex_init(lock, name, key); | 66 | debug_mutex_init(lock, name, key); |
diff --git a/kernel/locking/rwsem-xadd.c b/kernel/locking/rwsem-xadd.c index b77a6230bbf6..7190592c2645 100644 --- a/kernel/locking/rwsem-xadd.c +++ b/kernel/locking/rwsem-xadd.c | |||
| @@ -84,7 +84,7 @@ void __init_rwsem(struct rw_semaphore *sem, const char *name, | |||
| 84 | INIT_LIST_HEAD(&sem->wait_list); | 84 | INIT_LIST_HEAD(&sem->wait_list); |
| 85 | #ifdef CONFIG_SMP | 85 | #ifdef CONFIG_SMP |
| 86 | sem->owner = NULL; | 86 | sem->owner = NULL; |
| 87 | atomic_set(&sem->osq.tail, OSQ_UNLOCKED_VAL); | 87 | osq_lock_init(&sem->osq); |
| 88 | #endif | 88 | #endif |
| 89 | } | 89 | } |
| 90 | 90 | ||
