Function report |
Source Code:kernel\locking\rwsem.c |
Create Date:2022-07-28 09:48:15 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:Wait for the read lock to be granted
Proto:static struct rw_semaphore __sched *rwsem_down_read_slowpath(struct rw_semaphore *sem, int state)
Type:struct rw_semaphore
Parameter:
Type | Parameter | Name |
---|---|---|
struct rw_semaphore * | sem | |
int | state |
997 | adjustment = -RWSEM_READER_BIAS |
1000 | bool wake = false |
1010 | If Not rwsem_can_spin_on_owner(sem, RWSEM_RD_NONSPINNABLE) Then Go to queue |
1016 | atomic_long_add( - RWSEM_READER_BIAS, & count) |
1017 | adjustment = 0 |
1018 | If rwsem_optimistic_spin(sem, false) Then |
1024 | If atomic_long_read( & count) & RWSEM_FLAG_WAITERS Then |
1025 | raw_spin_lock_irq( & wait_lock) |
1029 | raw_spin_unlock_irq( & wait_lock) |
1032 | Return sem |
1033 | Else if rwsem_reader_phase_trylock(sem, last_rowner) Then |
1035 | Return sem |
1038 | queue : |
1039 | task = current process |
1040 | type = RWSEM_WAITING_FOR_READ |
1043 | raw_spin_lock_irq( & wait_lock) |
1051 | If adjustment && Not (atomic_long_read( & count) & (RWSEM_WRITER_MASK | RWSEM_FLAG_HANDOFF)) Then |
1060 | adjustment += RWSEM_FLAG_WAITERS |
1065 | If adjustment Then count = atomic_long_add_return(adjustment, & count) |
1067 | Else count = atomic_long_read( & count) |
1076 | If Not (count & RWSEM_LOCK_MASK) Then |
1077 | clear_wr_nonspinnable(sem) |
1078 | wake = true |
1084 | raw_spin_unlock_irq( & wait_lock) |
1088 | cycle |
1089 | set_current_state(state) |
1090 | If Not smp_load_acquire( & task) Then |
1092 | Break |
1094 | If signal_pending_state(state, current process) Then |
1095 | raw_spin_lock_irq( & wait_lock) |
1096 | If task Then Go to out_nolock |
1098 | raw_spin_unlock_irq( & wait_lock) |
1100 | Break |
1102 | schedule() |
1108 | Return sem |
1110 | out_nolock : |
1116 | raw_spin_unlock_irq( & wait_lock) |
Name | Describe |
---|---|
__down_read | lock for reading |
__down_read_killable |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |