mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-10-31 18:09:19 +00:00
fc9499e55a
* Package version: T713XXU2BQCO Change-Id: I293d9e7f2df458c512d59b7a06f8ca6add610c99
27 lines
626 B
C
27 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
|