cregit-Linux how code gets into the kernel

Release 4.7 kernel/locking/rwsem.c

Directory: kernel/locking
/* kernel/rwsem.c: R/W semaphores, public implementation
 *
 * Written by David Howells (dhowells@redhat.com).
 * Derived from asm-i386/semaphore.h
 */

#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/export.h>
#include <linux/rwsem.h>
#include <linux/atomic.h>

#include "rwsem.h"

/*
 * lock for reading
 */

void __sched down_read(struct rw_semaphore *sem) { might_sleep(); rwsem_acquire_read(&sem->dep_map, 0, 0, _RET_IP_); LOCK_CONTENDED(sem, __down_read_trylock, __down_read); }

Contributors

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar3183.78%133.33%
peter zijlstrapeter zijlstra513.51%133.33%
livio soareslivio soares12.70%133.33%
Total37100.00%3100.00%

EXPORT_SYMBOL(down_read); /* * trylock for reading -- returns 1 if successful, 0 if contention */
int down_read_trylock(struct rw_semaphore *sem) { int ret = __down_read_trylock(sem); if (ret == 1) rwsem_acquire_read(&sem->dep_map, 0, 1, _RET_IP_); return ret; }

Contributors

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar41100.00%1100.00%
Total41100.00%1100.00%

EXPORT_SYMBOL(down_read_trylock); /* * lock for writing */
void __sched down_write(struct rw_semaphore *sem) { might_sleep(); rwsem_acquire(&sem->dep_map, 0, 0, _RET_IP_); LOCK_CONTENDED(sem, __down_write_trylock, __down_write); rwsem_set_owner(sem); }

Contributors

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar3173.81%125.00%
peter zijlstrapeter zijlstra511.90%125.00%
davidlohr buesodavidlohr bueso511.90%125.00%
livio soareslivio soares12.38%125.00%
Total42100.00%4100.00%

EXPORT_SYMBOL(down_write); /* * lock for writing */
int __sched down_write_killable(struct rw_semaphore *sem) { might_sleep(); rwsem_acquire(&sem->dep_map, 0, 0, _RET_IP_); if (LOCK_CONTENDED_RETURN(sem, __down_write_trylock, __down_write_killable)) { rwsem_release(&sem->dep_map, 1, _RET_IP_); return -EINTR; } rwsem_set_owner(sem); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
michal hockomichal hocko65100.00%1100.00%
Total65100.00%1100.00%

EXPORT_SYMBOL(down_write_killable); /* * trylock for writing -- returns 1 if successful, 0 if contention */
int down_write_trylock(struct rw_semaphore *sem) { int ret = __down_write_trylock(sem); if (ret == 1) { rwsem_acquire(&sem->dep_map, 0, 1, _RET_IP_); rwsem_set_owner(sem); } return ret; }

Contributors

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar4083.33%133.33%
davidlohr buesodavidlohr bueso714.58%133.33%
pavel emelianovpavel emelianov12.08%133.33%
Total48100.00%3100.00%

EXPORT_SYMBOL(down_write_trylock); /* * release a read lock */
void up_read(struct rw_semaphore *sem) { rwsem_release(&sem->dep_map, 1, _RET_IP_); __up_read(sem); }

Contributors

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar27100.00%1100.00%
Total27100.00%1100.00%

EXPORT_SYMBOL(up_read); /* * release a write lock */
void up_write(struct rw_semaphore *sem) { rwsem_release(&sem->dep_map, 1, _RET_IP_); rwsem_clear_owner(sem); __up_write(sem); }

Contributors

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar2784.38%150.00%
davidlohr buesodavidlohr bueso515.62%150.00%
Total32100.00%2100.00%

EXPORT_SYMBOL(up_write); /* * downgrade write lock to read lock */
void downgrade_write(struct rw_semaphore *sem) { /* * lockdep: a downgraded write will live on as a write * dependency. */ rwsem_clear_owner(sem); __downgrade_write(sem); }

Contributors

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar1676.19%150.00%
davidlohr buesodavidlohr bueso523.81%150.00%
Total21100.00%2100.00%

EXPORT_SYMBOL(downgrade_write); #ifdef CONFIG_DEBUG_LOCK_ALLOC
void down_read_nested(struct rw_semaphore *sem, int subclass) { might_sleep(); rwsem_acquire_read(&sem->dep_map, subclass, 0, _RET_IP_); LOCK_CONTENDED(sem, __down_read_trylock, __down_read); }

Contributors

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar3487.18%150.00%
peter zijlstrapeter zijlstra512.82%150.00%
Total39100.00%2100.00%

EXPORT_SYMBOL(down_read_nested);
void _down_write_nest_lock(struct rw_semaphore *sem, struct lockdep_map *nest) { might_sleep(); rwsem_acquire_nest(&sem->dep_map, 0, 0, nest, _RET_IP_); LOCK_CONTENDED(sem, __down_write_trylock, __down_write); rwsem_set_owner(sem); }

Contributors

PersonTokensPropCommitsCommitProp
jiri kosinajiri kosina4389.58%150.00%
davidlohr buesodavidlohr bueso510.42%150.00%
Total48100.00%2100.00%

EXPORT_SYMBOL(_down_write_nest_lock);
void down_read_non_owner(struct rw_semaphore *sem) { might_sleep(); __down_read(sem); }

Contributors

PersonTokensPropCommitsCommitProp
kent overstreetkent overstreet18100.00%1100.00%
Total18100.00%1100.00%

EXPORT_SYMBOL(down_read_non_owner);
void down_write_nested(struct rw_semaphore *sem, int subclass) { might_sleep(); rwsem_acquire(&sem->dep_map, subclass, 0, _RET_IP_); LOCK_CONTENDED(sem, __down_write_trylock, __down_write); rwsem_set_owner(sem); }

Contributors

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar3579.55%133.33%
davidlohr buesodavidlohr bueso511.36%133.33%
peter zijlstrapeter zijlstra49.09%133.33%
Total44100.00%3100.00%

EXPORT_SYMBOL(down_write_nested);
int __sched down_write_killable_nested(struct rw_semaphore *sem, int subclass) { might_sleep(); rwsem_acquire(&sem->dep_map, subclass, 0, _RET_IP_); if (LOCK_CONTENDED_RETURN(sem, __down_write_trylock, __down_write_killable)) { rwsem_release(&sem->dep_map, 1, _RET_IP_); return -EINTR; } rwsem_set_owner(sem); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
al viroal viro68100.00%1100.00%
Total68100.00%1100.00%

EXPORT_SYMBOL(down_write_killable_nested);
void up_read_non_owner(struct rw_semaphore *sem) { __up_read(sem); }

Contributors

PersonTokensPropCommitsCommitProp
kent overstreetkent overstreet15100.00%1100.00%
Total15100.00%1100.00%

EXPORT_SYMBOL(up_read_non_owner); #endif

Overall Contributors

PersonTokensPropCommitsCommitProp
ingo molnaringo molnar35354.31%215.38%
al viroal viro7311.23%17.69%
michal hockomichal hocko7110.92%17.69%
jiri kosinajiri kosina487.38%17.69%
kent overstreetkent overstreet436.62%17.69%
davidlohr buesodavidlohr bueso355.38%215.38%
peter zijlstrapeter zijlstra192.92%17.69%
livio soareslivio soares50.77%17.69%
arun sharmaarun sharma10.15%17.69%
paul gortmakerpaul gortmaker10.15%17.69%
pavel emelianovpavel emelianov10.15%17.69%
Total650100.00%13100.00%
Directory: kernel/locking
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
{% endraw %}