函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\locking\rtmutex.c Create Date:2022-07-27 10:52:36
Last Modify:2020-03-17 14:26:38 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Slow path lock function:

函数原型:static int __sched rt_mutex_slowlock(struct rt_mutex *lock, int state, struct hrtimer_sleeper *timeout, enum rtmutex_chainwalk chwalk)

返回类型:int

参数:

类型参数名称
struct rt_mutex *lock
intstate
struct hrtimer_sleeper *timeout
enum rtmutex_chainwalkchwalk
1236  ret等于0
1238  rt_mutex_init_waiter( & waiter)
1248  raw_spin_lock_irqsave( & 保护自旋锁, flags)
1251  如果Try to take an rt-mutex* Must be called with lock->wait_lock held and interrupts disabled*@lock: The lock to be acquired
1252  raw_spin_unlock_irqrestore( & 保护自旋锁, flags)
1253  返回:0
1256  set_current_state(state)
1259  如果此条件成立可能性小(为编译器优化)(timeout)则hrtimer_start_expires( & timer, HRTIMER_MODE_ABS)
1262  ret等于Task blocks on lock.* Prepare waiter and propagate pi chain* This must be called with lock->wait_lock held and interrupts disabled
1264  如果此条件成立可能性大(为编译器优化)(!ret)则ret等于__rt_mutex_slowlock() - Perform the wait-wake-try-to-take loop*@lock: the rt_mutex to take*@state: the state the task should block in (TASK_INTERRUPTIBLE* or TASK_UNINTERRUPTIBLE)*@timeout: the pre-initialized and started timer, or NULL for none*@waiter:
1268  如果此条件成立可能性小(为编译器优化)(ret)则
1269  set_current_state() includes a barrier so that the write of current->state* is correctly serialised wrt the caller's subsequent test of whether to* actually sleep:* for (;;) {* set_current_state(TASK_UNINTERRUPTIBLE);* if (!need_sleep)* break;* (就绪态)
1270  Remove a waiter from a lock and give up* Must be called with lock->wait_lock held and interrupts disabled. I must* have just failed to try_to_take_rt_mutex().
1271  rt_mutex_handle_deadlock(ret, chwalk, & waiter)
1278  fixup_rt_mutex_waiters(lock)
1280  raw_spin_unlock_irqrestore( & 保护自旋锁, flags)
1283  如果此条件成立可能性小(为编译器优化)(timeout)则hrtimer_cancel( & timer)
1286  debug_rt_mutex_free_waiter( & waiter)
1288  返回:ret