Function report | 
Source Code:kernel\locking\osq_lock.c | 
Create Date:2022-07-28 09:51:18 | 
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:osq_lock
Proto:bool osq_lock(struct optimistic_spin_queue *lock)
Type:bool
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| struct optimistic_spin_queue * | lock | 
| 92 | node = this_cpu_ptr( & An MCS like lock especially tailored for optimistic spinning for sleeping* lock implementations (mutex, rwsem, etc)) | 
| 94 | curr = We use the value 0 to represent "no CPU", thus the encoded value* will be the CPU number incremented by 1. | 
| 97 | 1 if lock acquired = 0 | 
| 98 | next = NULL | 
| 107 | old = atomic_xchg( & * 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., curr) | 
| 108 | If old == OSQ_UNLOCKED_VAL Then Return true | 
| 111 | prev = decode_cpu(old) | 
| 124 | smp_wmb() | 
| 126 | WRITE_ONCE(next, node) | 
| 137 | When Not READ_ONCE(1 if lock acquired ) cycle | 
| 143 | If need_resched() || In order to reduce various lock holder preemption latencies provide an* interface to see if a vCPU is currently running or not Then Go to unqueue | 
| 146 | cpu_relax() | 
| 148 | Return true | 
| 150 | unqueue : | 
| 159 | cycle | 
| 169 | If smp_load_acquire( & 1 if lock acquired ) Then Return true | 
| 172 | cpu_relax() | 
| 188 | next = Get a stable @node->next pointer, either for unlock() or unqueue() purposes.* Can return NULL in case we were the last queued and we updated @lock instead. | 
| 189 | If Not next Then Return false | 
| 200 | WRITE_ONCE(prev, prev) | 
| 201 | WRITE_ONCE(next, next) | 
| 203 | Return false | 
| 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  |