函数逻辑报告 |
Source Code:kernel\locking\osq_lock.c |
Create Date:2022-07-27 10:51:34 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| 首页 | 函数Tree |
| 注解内核,赢得工具 | 下载SCCT | English |
函数名称:osq_lock
函数原型:bool osq_lock(struct optimistic_spin_queue *lock)
返回类型:bool
参数:
| 类型 | 参数 | 名称 |
|---|---|---|
| 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 | 如果old恒等于OSQ_UNLOCKED_VAL则返回:true |
| 111 | prev等于decode_cpu(old) |
| 124 | smp_wmb() |
| 126 | WRITE_ONCE(next, node) |
| 137 | 当非READ_ONCE(1 if lock acquired )循环 |
| 143 | 如果need_resched()或In order to reduce various lock holder preemption latencies provide an* interface to see if a vCPU is currently running or not则转到:unqueue |
| 146 | cpu_relax() |
| 148 | 返回:true |
| 150 | unqueue : |
| 159 | 循环 |
| 169 | 如果smp_load_acquire( & 1 if lock acquired )则返回: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 | 如果非next则返回:false |
| 200 | WRITE_ONCE(prev, prev) |
| 201 | WRITE_ONCE(next, next) |
| 203 | 返回:false |
| 源代码转换工具 开放的插件接口 | X |
|---|---|
| 支持:c/c++/esqlc/java Oracle/Informix/Mysql 插件可实现:逻辑报告 代码生成和批量转换代码 |