#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). */ struct optimistic_spin_node { struct optimistic_spin_node *next, *prev; int locked; /* 1 if lock acquired */ int cpu; /* encoded CPU # + 1 value */ }; 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; }; #define OSQ_UNLOCKED_VAL (0) /* 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); }Contributors
Person | Tokens | Prop | Commits | CommitProp | |
jason low | jason low | 22 | 100.00% | 1 | 100.00% |
Total | 22 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp | |
waiman long | waiman long | 23 | 100.00% | 1 | 100.00% |
Total | 23 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp | |
davidlohr bueso | davidlohr bueso | 45 | 39.82% | 1 | 25.00% |
jason low | jason low | 45 | 39.82% | 2 | 50.00% |
waiman long | waiman long | 23 | 20.35% | 1 | 25.00% |
Total | 113 | 100.00% | 4 | 100.00% |