函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Adjust the priority chain

函数原型:static int rt_mutex_adjust_prio_chain(struct task_struct *task, enum rtmutex_chainwalk chwalk, struct rt_mutex *orig_lock, struct rt_mutex *next_lock, struct rt_mutex_waiter *orig_waiter, struct task_struct *top_task)

返回类型:int

参数:

类型参数名称
struct task_struct *task
enum rtmutex_chainwalkchwalk
struct rt_mutex *orig_lock
struct rt_mutex *next_lock
struct rt_mutex_waiter *orig_waiter
struct task_struct *top_task
456  top_waiter等于orig_waiter
458  ret等于0, depth等于0
461  bool requeue = true
463  detect_deadlock等于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
471  again :
475  如果depth先自加大于Max number of times we'll walk the boosting chain:
488  put_task_struct(task)
490  返回:负EDEADLK
499  retry :
503  关闭本地中断,获取所要保护的运行队列(runqueue)的自旋锁(spinlock),为查找可运行进程做准备。( & Protection of the PI data structures: )
508  waiter等于pi_blocked_on
519  如果非waiter则转到:out_unlock_pi
526  如果orig_waiter且非rt_mutex_owner(orig_lock)则转到:out_unlock_pi
538  如果next_lock不等于lock则转到:out_unlock_pi
546  如果top_waiter
547  如果非task_has_pi_waiters(task)则转到:out_unlock_pi
555  如果top_waiter不等于task_top_pi_waiter(task)则
556  如果非detect_deadlock则转到:out_unlock_pi
558  否则requeue = false
570  如果rt_mutex_waiter_equal(waiter, Only use with rt_mutex_waiter_{less,equal}()(task))则
571  如果非detect_deadlock则转到:out_unlock_pi
573  否则requeue = false
580  lock等于lock
586  如果非Define the various spin_lock methods. Note we define these* regardless of whether CONFIG_SMP or CONFIG_PREEMPTION are set. The* various methods are defined as nops in the case they are not* required.( & 保护自旋锁)则
587  raw_spin_unlock_irq( & Protection of the PI data structures: )
588  cpu_relax()
589  转到:retry
601  如果lock恒等于orig_lockrt_mutex_owner(lock)恒等于top_task
602  debug_rt_mutex_deadlock(chwalk, orig_waiter, lock)
603  raw_spin_unlock( & 保护自旋锁)
604  ret等于负EDEADLK
605  转到:out_unlock_pi
614  如果非requeue
618  raw_spin_unlock( & Protection of the PI data structures: )
619  put_task_struct(task)
625  如果非rt_mutex_owner(lock)则
627  返回:0
631  task等于get_task_struct(rt_mutex_owner(lock))
632  raw_spin_lock( & Protection of the PI data structures: )
640  next_lock等于task_blocked_on_lock(task)
644  top_waiter等于rt_mutex_top_waiter(lock)
647  raw_spin_unlock( & Protection of the PI data structures: )
648  raw_spin_unlock_irq( & 保护自旋锁)
651  如果非next_lock则转到:out_put_task
653  转到:again
661  prerequeue_top_waiter等于rt_mutex_top_waiter(lock)
664  rt_mutex_dequeue(lock, waiter)
682  prio等于prio
683  deadline等于 Absolute deadline for this instance
685  rt_mutex_enqueue(lock, waiter)
688  raw_spin_unlock( & Protection of the PI data structures: )
689  put_task_struct(task)
698  如果非rt_mutex_owner(lock)则
704  如果prerequeue_top_waiter不等于rt_mutex_top_waiter(lock)则唤醒中断线程
706  raw_spin_unlock_irq( & 保护自旋锁)
707  返回:0
711  task等于get_task_struct(rt_mutex_owner(lock))
712  raw_spin_lock( & Protection of the PI data structures: )
715  如果waiter恒等于rt_mutex_top_waiter(lock)则
722  rt_mutex_dequeue_pi(task, prerequeue_top_waiter)
723  rt_mutex_enqueue_pi(task, waiter)
724  rt_mutex_adjust_prio(task)
726  否则如果prerequeue_top_waiter恒等于waiter
737  rt_mutex_dequeue_pi(task, waiter)
738  waiter等于rt_mutex_top_waiter(lock)
739  rt_mutex_enqueue_pi(task, waiter)
740  rt_mutex_adjust_prio(task)
741  否则next_lock等于task_blocked_on_lock(task)
763  top_waiter等于rt_mutex_top_waiter(lock)
766  raw_spin_unlock( & Protection of the PI data structures: )
767  raw_spin_unlock_irq( & 保护自旋锁)
776  如果非next_lock则转到:out_put_task
784  如果非detect_deadlockwaiter不等于top_waiter则转到:out_put_task
787  转到:again
789  out_unlock_pi :
790  raw_spin_unlock_irq( & Protection of the PI data structures: )
791  out_put_task :
792  put_task_struct(task)
794  返回:ret
调用者
名称描述
task_blocks_on_rt_mutexTask blocks on lock.* Prepare waiter and propagate pi chain* This must be called with lock->wait_lock held and interrupts disabled
remove_waiterRemove 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().
rt_mutex_adjust_piRecheck the pi chain, in case we got a priority setting* Called from sched_setscheduler