aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorJason Low <jason.low2@hp.com>2014-07-14 13:27:50 -0400
committerIngo Molnar <mingo@kernel.org>2014-07-16 07:28:05 -0400
commit4d9d951e6b5df85ccfca2c5bd8b4f5c71d256b65 (patch)
tree451c3e6656bb75fa42baa97d344db38bdab7f4ab /include/linux
parent90631822c5d307b5410500806e8ac3e63928aa3e (diff)
locking/spinlocks/mcs: Introduce and use init macro and function for osq locks
Currently, we initialize the osq lock by directly setting the lock's values. It would be preferable if we use an init macro to do the initialization like we do with other locks. This patch introduces and uses a macro and function for initializing the osq lock. Signed-off-by: Jason Low <jason.low2@hp.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Cc: Scott Norton <scott.norton@hp.com> Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> Cc: Dave Chinner <david@fromorbit.com> Cc: Waiman Long <waiman.long@hp.com> Cc: Davidlohr Bueso <davidlohr@hp.com> Cc: Rik van Riel <riel@redhat.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Tim Chen <tim.c.chen@linux.intel.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Aswin Chandramouleeswaran <aswin@hp.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Chris Mason <clm@fb.com> Cc: Josef Bacik <jbacik@fusionio.com> Link: http://lkml.kernel.org/r/1405358872-3732-4-git-send-email-jason.low2@hp.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/osq_lock.h8
-rw-r--r--include/linux/rwsem.h2
2 files changed, 9 insertions, 1 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
22static 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) \