Release 4.7 kernel/locking/rwsem.c
/* 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
| Person | Tokens | Prop | Commits | CommitProp |
ingo molnar | ingo molnar | 31 | 83.78% | 1 | 33.33% |
peter zijlstra | peter zijlstra | 5 | 13.51% | 1 | 33.33% |
livio soares | livio soares | 1 | 2.70% | 1 | 33.33% |
| Total | 37 | 100.00% | 3 | 100.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
| Person | Tokens | Prop | Commits | CommitProp |
ingo molnar | ingo molnar | 41 | 100.00% | 1 | 100.00% |
| Total | 41 | 100.00% | 1 | 100.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
| Person | Tokens | Prop | Commits | CommitProp |
ingo molnar | ingo molnar | 31 | 73.81% | 1 | 25.00% |
peter zijlstra | peter zijlstra | 5 | 11.90% | 1 | 25.00% |
davidlohr bueso | davidlohr bueso | 5 | 11.90% | 1 | 25.00% |
livio soares | livio soares | 1 | 2.38% | 1 | 25.00% |
| Total | 42 | 100.00% | 4 | 100.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
| Person | Tokens | Prop | Commits | CommitProp |
michal hocko | michal hocko | 65 | 100.00% | 1 | 100.00% |
| Total | 65 | 100.00% | 1 | 100.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
| Person | Tokens | Prop | Commits | CommitProp |
ingo molnar | ingo molnar | 40 | 83.33% | 1 | 33.33% |
davidlohr bueso | davidlohr bueso | 7 | 14.58% | 1 | 33.33% |
pavel emelianov | pavel emelianov | 1 | 2.08% | 1 | 33.33% |
| Total | 48 | 100.00% | 3 | 100.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
| Person | Tokens | Prop | Commits | CommitProp |
ingo molnar | ingo molnar | 27 | 100.00% | 1 | 100.00% |
| Total | 27 | 100.00% | 1 | 100.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
| Person | Tokens | Prop | Commits | CommitProp |
ingo molnar | ingo molnar | 27 | 84.38% | 1 | 50.00% |
davidlohr bueso | davidlohr bueso | 5 | 15.62% | 1 | 50.00% |
| Total | 32 | 100.00% | 2 | 100.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
| Person | Tokens | Prop | Commits | CommitProp |
ingo molnar | ingo molnar | 16 | 76.19% | 1 | 50.00% |
davidlohr bueso | davidlohr bueso | 5 | 23.81% | 1 | 50.00% |
| Total | 21 | 100.00% | 2 | 100.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
| Person | Tokens | Prop | Commits | CommitProp |
ingo molnar | ingo molnar | 34 | 87.18% | 1 | 50.00% |
peter zijlstra | peter zijlstra | 5 | 12.82% | 1 | 50.00% |
| Total | 39 | 100.00% | 2 | 100.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
| Person | Tokens | Prop | Commits | CommitProp |
jiri kosina | jiri kosina | 43 | 89.58% | 1 | 50.00% |
davidlohr bueso | davidlohr bueso | 5 | 10.42% | 1 | 50.00% |
| Total | 48 | 100.00% | 2 | 100.00% |
EXPORT_SYMBOL(_down_write_nest_lock);
void down_read_non_owner(struct rw_semaphore *sem)
{
might_sleep();
__down_read(sem);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
kent overstreet | kent overstreet | 18 | 100.00% | 1 | 100.00% |
| Total | 18 | 100.00% | 1 | 100.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
| Person | Tokens | Prop | Commits | CommitProp |
ingo molnar | ingo molnar | 35 | 79.55% | 1 | 33.33% |
davidlohr bueso | davidlohr bueso | 5 | 11.36% | 1 | 33.33% |
peter zijlstra | peter zijlstra | 4 | 9.09% | 1 | 33.33% |
| Total | 44 | 100.00% | 3 | 100.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
| Person | Tokens | Prop | Commits | CommitProp |
al viro | al viro | 68 | 100.00% | 1 | 100.00% |
| Total | 68 | 100.00% | 1 | 100.00% |
EXPORT_SYMBOL(down_write_killable_nested);
void up_read_non_owner(struct rw_semaphore *sem)
{
__up_read(sem);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
kent overstreet | kent overstreet | 15 | 100.00% | 1 | 100.00% |
| Total | 15 | 100.00% | 1 | 100.00% |
EXPORT_SYMBOL(up_read_non_owner);
#endif
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
ingo molnar | ingo molnar | 353 | 54.31% | 2 | 15.38% |
al viro | al viro | 73 | 11.23% | 1 | 7.69% |
michal hocko | michal hocko | 71 | 10.92% | 1 | 7.69% |
jiri kosina | jiri kosina | 48 | 7.38% | 1 | 7.69% |
kent overstreet | kent overstreet | 43 | 6.62% | 1 | 7.69% |
davidlohr bueso | davidlohr bueso | 35 | 5.38% | 2 | 15.38% |
peter zijlstra | peter zijlstra | 19 | 2.92% | 1 | 7.69% |
livio soares | livio soares | 5 | 0.77% | 1 | 7.69% |
arun sharma | arun sharma | 1 | 0.15% | 1 | 7.69% |
paul gortmaker | paul gortmaker | 1 | 0.15% | 1 | 7.69% |
pavel emelianov | pavel emelianov | 1 | 0.15% | 1 | 7.69% |
| Total | 650 | 100.00% | 13 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.