Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\locking\rtmutex.c Create Date:2022-07-28 09:52:12
Last Modify:2020-03-17 14:26:38 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Task blocks on lock.* Prepare waiter and propagate pi chain* This must be called with lock->wait_lock held and interrupts disabled

Proto:static int task_blocks_on_rt_mutex(struct rt_mutex *lock, struct rt_mutex_waiter *waiter, struct task_struct *task, enum rtmutex_chainwalk chwalk)

Type:int

Parameter:

TypeParameterName
struct rt_mutex *lock
struct rt_mutex_waiter *waiter
struct task_struct *task
enum rtmutex_chainwalkchwalk
933  owner = rt_mutex_owner(lock)
934  top_waiter = waiter
936  chain_walk = 0
938  lockdep_assert_held( & wait_lock)
949  If owner == task Then Return -EDEADLK
952  raw_spin_lock( & Protection of the PI data structures: )
953  task = task
954  lock = lock
955  prio = prio
956  deadline = Absolute deadline for this instance
959  If rt_mutex_has_waiters(lock) Then top_waiter = rt_mutex_top_waiter(lock)
961  rt_mutex_enqueue(lock, waiter)
963  pi_blocked_on = waiter
965  raw_spin_unlock( & Protection of the PI data structures: )
967  If Not owner Then Return 0
970  raw_spin_lock( & Protection of the PI data structures: )
971  If waiter == rt_mutex_top_waiter(lock) Then
972  rt_mutex_dequeue_pi(owner, top_waiter)
973  rt_mutex_enqueue_pi(owner, waiter)
975  rt_mutex_adjust_prio(owner)
976  If pi_blocked_on Then chain_walk = 1
978  Else if Deadlock detection is conditional:* If CONFIG_DEBUG_RT_MUTEXES=n, deadlock detection is only conducted* if the detect argument is == RT_MUTEX_FULL_CHAINWALK.* If CONFIG_DEBUG_RT_MUTEXES=y, deadlock detection is always Then
979  chain_walk = 1
983  next_lock = task_blocked_on_lock(owner)
985  raw_spin_unlock( & Protection of the PI data structures: )
991  If Not chain_walk || Not next_lock Then Return 0
999  get_task_struct(owner)
1001  raw_spin_unlock_irq( & wait_lock)
1003  res = Adjust the priority chain
1006  raw_spin_lock_irq( & wait_lock)
1008  Return res
Caller
NameDescribe
rt_mutex_slowlockSlow path lock function:
__rt_mutex_start_proxy_lock__rt_mutex_start_proxy_lock() - Start lock acquisition for another task*@lock: the rt_mutex to take*@waiter: the pre-initialized rt_mutex_waiter*@task: the task to prepare* Starts the rt_mutex acquire; it enqueues the @waiter and does deadlock* detection