函数逻辑报告 |
Source Code:kernel\locking\mutex.c |
Create Date:2022-07-27 10:47:51 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
首页 | 函数Tree |
注解内核,赢得工具 | 下载SCCT | English |
函数名称:Lock a mutex (possibly interruptible), slowpath:
函数原型:static __always_inline int __sched __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, struct lockdep_map *nest_lock, unsigned long ip, struct ww_acquire_ctx *ww_ctx, const bool use_ww_ctx)
返回类型:int
参数:
类型 | 参数 | 名称 |
---|---|---|
struct mutex * | lock | |
long | state | |
unsigned int | subclass | |
struct lockdep_map * | nest_lock | |
unsigned long | ip | |
struct ww_acquire_ctx * | ww_ctx | |
const bool | use_ww_ctx |
931 | bool first = false |
935 | might_sleep() |
942 | 如果use_ww_ctx且ww_ctx则 |
955 | 禁止抢占() |
956 | mutex_acquire_nest( & dep_map, subclass, 0, nest_lock, ip) |
961 | lock_acquired( & dep_map, ip) |
962 | 如果use_ww_ctx且ww_ctx则After acquiring lock with fastpath, where we do not hold wait_lock, set ctx* and wake up any waiters so they can recheck. |
964 | 禁用抢占和中断() |
965 | 返回:0 |
968 | 加自旋锁 |
976 | 转到:skip_wait |
979 | debug_mutex_lock_common(lock, & waiter) |
981 | lock_contended( & dep_map, ip) |
983 | 如果非use_ww_ctx则 |
991 | 否则 |
997 | 如果ret则转到:err_early_kill |
1005 | set_current_state(state) |
1006 | 循环 |
1021 | 如果signal_pending_state(state, 当前进程)则 |
1026 | 如果use_ww_ctx且ww_ctx则 |
1032 | 自旋锁解锁 |
1039 | 如果use_ww_ctx且ww_ctx或非first则 |
1040 | first等于__mutex_waiter_is_first(lock, & waiter) |
1041 | 如果first则__mutex_set_flag(lock, MUTEX_FLAG_HANDOFF) |
1045 | set_current_state(state) |
1051 | 如果Actual trylock that will work on any unlocked state.或first且mutex_optimistic_spin(lock, ww_ctx, use_ww_ctx, & waiter)则退出 |
1055 | 加自旋锁 |
1057 | 加自旋锁 |
1058 | acquired : |
1061 | 如果use_ww_ctx且ww_ctx则 |
1072 | 如果此条件成立可能性大(为编译器优化)(链表为空)则__mutex_clear_flag(lock, MUTEX_FLAGS) |
1075 | debug_mutex_free_waiter( & waiter) |
1077 | skip_wait : |
1079 | lock_acquired( & dep_map, ip) |
1081 | 如果use_ww_ctx且ww_ctx则Associate the ww_mutex @ww with the context @ww_ctx under which we acquired* it. |
1084 | 自旋锁解锁 |
1085 | 禁用抢占和中断() |
1086 | 返回:0 |
1088 | err : |
1091 | err_early_kill : |
1092 | 自旋锁解锁 |
1093 | debug_mutex_free_waiter( & waiter) |
1094 | mutex_release( & dep_map, ip) |
1095 | 禁用抢占和中断() |
1096 | 返回:ret |
源代码转换工具 开放的插件接口 | X |
---|---|
支持:c/c++/esqlc/java Oracle/Informix/Mysql 插件可实现:逻辑报告 代码生成和批量转换代码 |