函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\locking\mutex.c Create Date:2022-07-27 10:47:46
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Add @waiter to the wait-list, keep the wait-list ordered by stamp, smallest* first

函数原型:static inline int __sched __ww_mutex_add_waiter(struct mutex_waiter *waiter, struct mutex *lock, struct ww_acquire_ctx *ww_ctx)

返回类型:int

参数:

类型参数名称
struct mutex_waiter *waiter
struct mutex *lock
struct ww_acquire_ctx *ww_ctx
860  如果非ww_ctx
861  Add @waiter to a given location in the lock wait_list and set the* FLAG_WAITERS flag if it's the first waiter.
862  返回:0
865  is_wait_die等于is_wait_die
874  pos等于wait_list
876  如果非ww_ctx则继续下一循环
879  如果Determine if context @a is 'after' context @b. IOW, @a is a younger* transaction than @b and depending on algorithm either needs to wait for*@b or die.
885  如果is_wait_die
888  如果ret则返回:ret
892  退出
895  pos等于list
898  Wait-Die; wake a younger waiter context (when locks held) such that it can* die.* Among waiters with context, only the first one can have other locks acquired* already (ctx->acquired > 0), because __ww_mutex_add_waiter() and
901  Add @waiter to a given location in the lock wait_list and set the* FLAG_WAITERS flag if it's the first waiter.
907  如果非is_wait_die
908  ww等于container_of - cast a member of a structure out to the containing structure*@ptr: the pointer to the member.*@type: the type of the container struct this is embedded in.*@member: the name of the member within the struct.(lock, structww_mutex, base)
915  smp_mb()
916  Wound-Wait; wound a younger @hold_ctx if it holds the lock.* Wound the lock holder if there are waiters with older transactions than* the lock holders. Even if multiple waiters may wound the lock holder,* it's sufficient that only one does.
919  返回:0
调用者
名称描述
__mutex_lock_commonLock a mutex (possibly interruptible), slowpath: