mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-04 11:06:58 +07:00
4d9d951e6b
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>
28 lines
626 B
C
28 lines
626 B
C
#ifndef __LINUX_OSQ_LOCK_H
|
|
#define __LINUX_OSQ_LOCK_H
|
|
|
|
/*
|
|
* An MCS like lock especially tailored for optimistic spinning for sleeping
|
|
* lock implementations (mutex, rwsem, etc).
|
|
*/
|
|
|
|
#define OSQ_UNLOCKED_VAL (0)
|
|
|
|
struct optimistic_spin_queue {
|
|
/*
|
|
* Stores an encoded value of the CPU # of the tail node in the queue.
|
|
* If the queue is empty, then it's set to OSQ_UNLOCKED_VAL.
|
|
*/
|
|
atomic_t tail;
|
|
};
|
|
|
|
/* Init macro and function. */
|
|
#define OSQ_LOCK_UNLOCKED { ATOMIC_INIT(OSQ_UNLOCKED_VAL) }
|
|
|
|
static inline void osq_lock_init(struct optimistic_spin_queue *lock)
|
|
{
|
|
atomic_set(&lock->tail, OSQ_UNLOCKED_VAL);
|
|
}
|
|
|
|
#endif
|