Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\locking\mutex.c Create Date:2022-07-28 09:47:25
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Add @waiter to the wait-list, keep the wait-list ordered by stamp, smallest* first

Proto:static inline int __sched __ww_mutex_add_waiter(struct mutex_waiter *waiter, struct mutex *lock, struct ww_acquire_ctx *ww_ctx)

Type:int

Parameter:

TypeParameterName
struct mutex_waiter *waiter
struct mutex *lock
struct ww_acquire_ctx *ww_ctx
860  If Not ww_ctx Then
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  Return 0
865  is_wait_die = is_wait_die
874  pos = wait_list
876  If Not ww_ctx Then Continue
879  If 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. Then
885  If is_wait_die Then
888  If ret Then Return ret
892  Break
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  If Not is_wait_die Then
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  Return 0
Caller
NameDescribe
__mutex_lock_commonLock a mutex (possibly interruptible), slowpath: