cregit-Linux how code gets into the kernel

Release 4.15 include/linux/osq_lock.h

Directory: include/linux
/* SPDX-License-Identifier: GPL-2.0 */
#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

PersonTokensPropCommitsCommitProp
Jason Low22100.00%1100.00%
Total22100.00%1100.00%

extern bool osq_lock(struct optimistic_spin_queue *lock); extern void osq_unlock(struct optimistic_spin_queue *lock);
static inline bool osq_is_locked(struct optimistic_spin_queue *lock) { return atomic_read(&lock->tail) != OSQ_UNLOCKED_VAL; }

Contributors

PersonTokensPropCommitsCommitProp
Waiman Long23100.00%1100.00%
Total23100.00%1100.00%

#endif

Overall Contributors

PersonTokensPropCommitsCommitProp
Jason Low4539.47%240.00%
Davidlohr Bueso A4539.47%120.00%
Waiman Long2320.18%120.00%
Greg Kroah-Hartman10.88%120.00%
Total114100.00%5100.00%
Directory: include/linux
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.